views:

870

answers:

3

I have installed the Maven for Eclipse plugin from Sonatype.

(update site: http://m2eclipse.sonatype.org/update/)

I am creating a Maven project, and choosing to use the groovy-maven-archetype as my starting point.

However, halfway through, I am seeing:

04/03/09 12:52:28 GMT: [FATAL ERROR] 
org.codehaus.mojo.groovy.stubgen.GenerateStubsMojo#execute()
caused a linkage error (java.lang.NoSuchMethodError). Check the realms:

... snip ...

Realm ID: plexus.core

org.codehaus.plexus.PlexusContainer.createChildContainer
(Ljava/lang/String;Ljava/util/List;Ljava/util/Map;)
Lorg/codehaus/plexus/PlexusContainer;

How can I fix this?

A: 

Seems like a versioning problem to me. Are you sure you used all the right versions of the jars?

Suraj Chandran
Yeah, looks like an installation problem for me too. Try to reinstall m2eclipse. If that doesn't help, you get possibly better help at the m2eclipse users mailing list: http://m2eclipse.sonatype.org/project-information.html
Kutzi
+1  A: 

At a command prompt, enter this: mvn archetype:generate Then, choose 40 (gmaven-archetype-basic) Then, follow the prompts. Once you have a maven project, you can enable Eclipse support by saying: mvn eclipse:eclipse

You can read Building Groovy Projects for more information.

AWhitford
A: 

Getting Groovy-Eclipse, gmaven, and Eclipse all working together seems to be pretty tricky at the present. Once you've got a project created with mvn archetype:generate, as AWhitford mentions, this site will show you a few of the tweaks you'll need to make it work.

GMaven's stub creation for Java files interferes with Groovy-Eclipse, hence the section on that page about commenting out stub creation. However, I went with the method mentioned in the comments for the relevant bug (GMAVEN-61) and created multiple executions for the gmaven plugin, like so:

  <build>
    <plugins>
      <plugin>
        <groupId>org.codehaus.groovy.maven</groupId>
        <artifactId>gmaven-plugin</artifactId>
        <version>1.0-rc-3</version>
        <!-- http://jira.codehaus.org/browse/GMAVEN-61 -->
        <executions>
          <execution>
            <id>default-cli</id>
            <goals>
              <goal>compile</goal>
              <goal>testCompile</goal>
            </goals>
          </execution>
          <execution>
            <id>stubsonly</id>
            <goals>
              <goal>generateStubs</goal>
              <goal>generateTestStubs</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

I'm still not certain myself that this is clean for both pure Maven usage as well as within Eclipse, but it at least got me to the point where I stopped spending hours trying to get anything to work and got me coding on my actual project.

The Groovy-Eclipse and GMaven documentation are good reading for background info.

Lyle