GMaven (OLD... DO NOT USE)
  1. GMaven (OLD... DO NOT USE)
  2. MGROOVY-144

NoSuchMethodError during generateStubs from maven embedder

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.0-rc-2
    • Fix Version/s: 1.0-rc-4
    • Component/s: stub generation
    • Labels:
      None
    • Environment:
      Windows XP, Eclipse 3.3, q4e plugin (version 0.6.1.200804212151), eclipse running under Java 6, project targeting Java 1.4, groovy version 1.5.4
    • Number of attachments :
      0

      Description

      I get the following exception within our maven build in multiple IDEs (Eclipse 3.3 with both the m2eclipse plugin and q4e plugin, Netbeans 6.1, and IntelliJ 7.0.3) which all use the Maven embedder that's based on the maven 2.1 code base. I have a project that contains both groovy and several Java classes that import groovy classes. Everything works fine from the command line using maven 2.0.7 and the gmaven plugin version 1.0-rc-2. Here is my configuration for the gmaven plugin:

      <plugin>
      <groupId>org.codehaus.groovy.maven</groupId>
      <artifactId>gmaven-plugin</artifactId>
      <version>1.0-rc-2</version>
      <executions>
      <execution>
      <goals>
      <goal>generateStubs</goal>
      <goal>compile</goal>
      <goal>testCompile</goal>
      </goals>
      </execution>
      </executions>
      </plugin>

      From within eclipse 3.3 using the q4e plugin for maven integration I get this stack trace when the generateStubs goal is triggered:

      1:04:23 PM EDT info ------------------------------------------------------------------------
      1:04:23 PM EDT info Building TEP Core
      1:04:23 PM EDT info task-segment: [process-resources]
      1:04:23 PM EDT info ------------------------------------------------------------------------
      1:04:23 PM EDT Starting Starting projectExecution org.acspubs:TEPCore:jar:0.8.1 ( task-segment: [process-resources] )
      1:04:23 PM EDT Starting Starting mojoExecution groovy:generateStubs
      1:04:23 PM EDT fatal org.codehaus.groovy.maven.plugin.stubgen.GenerateStubsMojo#execute() caused a linkage error (java.lang.NoSuchMethodError) and may be out-of-date. Check the realms:
      1:04:23 PM EDT fatal Plugin realm =
      8<------------------ snip 8<---------------------
      1:04:23 PM EDT fatal Container realm = plexus.core

      1:04:23 PM EDT Error An error occurred in phase mojoExecution with the exception java.lang.NoSuchMethodError: org.codehaus.plexus.PlexusContainer.createChildContainer(Ljava/lang/String;Ljava/util/List;Ljava/util/Map;)Lorg/codehaus/plexus/PlexusContainer;

      I am seeing it in any IDE that uses the maven 2.1 embedder. I found a thread (http://www.nabble.com/Re%3A-New-groovy-maven-plugin-1.0-beta-3-SNAPSHOUT-p13503564.html) on the dev list where someone else had the same problem late last year.

      If you need additional information, please let me know. Thanks for the help.

        Activity

        Hide
        Sybren Stüvel added a comment - - edited

        I have the exact same issue with Eclipse 3.3 on Linux, Groovy 1.5.6, targeting Java 1.6

        Show
        Sybren Stüvel added a comment - - edited I have the exact same issue with Eclipse 3.3 on Linux, Groovy 1.5.6, targeting Java 1.6
        Hide
        Jason Dillon added a comment -

        I will try and fix this, though Maven 2.1 isn't released yet, so Its kinda hard to make a GMaven release to support Maven 2.1...

        Show
        Jason Dillon added a comment - I will try and fix this, though Maven 2.1 isn't released yet, so Its kinda hard to make a GMaven release to support Maven 2.1...
        Hide
        Sybren Stüvel added a comment -

        You could check out the sources at https://svn.apache.org/repos/asf/maven/components/branches/maven-2.1-xbr/ - they look like they might be of use.

        Show
        Sybren Stüvel added a comment - You could check out the sources at https://svn.apache.org/repos/asf/maven/components/branches/maven-2.1-xbr/ - they look like they might be of use.
        Hide
        Rae Egli added a comment -

        I encountered the same error in Eclipse: java.lang.NoSuchMethodError, and started searching for an answer which is why I landed here. Finding no immediate answer, I then tried to find out why.

        I somehow had omitted the static clause from:

        public static void main(String[] args)

        i.e.

        public void main(String[] args)

        As soon as I put it back, the error disappeared. Just thought you might want to know.

        Show
        Rae Egli added a comment - I encountered the same error in Eclipse: java.lang.NoSuchMethodError, and started searching for an answer which is why I landed here. Finding no immediate answer, I then tried to find out why. I somehow had omitted the static clause from: public static void main(String[] args) i.e. public void main(String[] args) As soon as I put it back, the error disappeared. Just thought you might want to know.
        Hide
        Jason Dillon added a comment -

        This is going to take more work than I'd like to fix. Unfortunately the version of Plexus used by Maven 2.0.x and 2.1.x is not compatible, even though I did see some compatibility aspects in there... not sure why they are not picked up.

        Will probably have to redesign the runtime plugin a bit to be isolated from the plexus version which Maven is using, and always use a know (and more recent/stable/sane) version.

        Show
        Jason Dillon added a comment - This is going to take more work than I'd like to fix. Unfortunately the version of Plexus used by Maven 2.0.x and 2.1.x is not compatible, even though I did see some compatibility aspects in there... not sure why they are not picked up. Will probably have to redesign the runtime plugin a bit to be isolated from the plexus version which Maven is using, and always use a know (and more recent/stable/sane) version.
        Hide
        Paul Smith added a comment -

        Does anyone have a work-around for this bug at the moment?

        Show
        Paul Smith added a comment - Does anyone have a work-around for this bug at the moment?
        Hide
        Jason Dillon added a comment -

        You can try 1.0-rc-4-SNAPSHOT (its publishing right now, so should be up in a few minutes). I ripped out Plexus for runtime component loading stuff and dropped in Spring... should work, though looks like it might be a wee bit slower, will optimize this stuff later.

        Show
        Jason Dillon added a comment - You can try 1.0-rc-4-SNAPSHOT (its publishing right now, so should be up in a few minutes). I ripped out Plexus for runtime component loading stuff and dropped in Spring... should work, though looks like it might be a wee bit slower, will optimize this stuff later.
        Hide
        Jason Mihalick added a comment -

        1.0-rc-4-SNAPSHOT has fixed my build problem. My build is now working within eclipse 3.3. I haven't been able to verify in other IDEs, but I'd be surprised if it didn't work in those as well. Thanks a lot for taking care of this. It's now possible for me to run my builds in eclipse with the embedder, whereas before it wasn't. Nice work.

        Show
        Jason Mihalick added a comment - 1.0-rc-4-SNAPSHOT has fixed my build problem. My build is now working within eclipse 3.3. I haven't been able to verify in other IDEs, but I'd be surprised if it didn't work in those as well. Thanks a lot for taking care of this. It's now possible for me to run my builds in eclipse with the embedder, whereas before it wasn't. Nice work.

          People

          • Assignee:
            Jason Dillon
            Reporter:
            Jason Mihalick
          • Votes:
            6 Vote for this issue
            Watchers:
            8 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: