- GMaven
- GMAVEN-86
Gmaven compile error when using with groovy 1.7.7 and 1.7.8
- Log In
-
Views
- XML
- Word
- Printable
Details
-
Type: Bug
-
Status: Closed
-
Priority: Critical
-
Resolution: Not A Bug
-
Affects Version/s: 1.3
-
Fix Version/s: None
-
Component/s: compile
-
Labels:None
-
Environment:Maven 3.0.2, Linux 2.6.32-28-generic i686 GNU/Linux
-
Testcase included:yes
-
Number of attachments :2
Description
Hi,
the gmaven plugin could not compile groovy sources if used with groovy 1.7.7 or 1.7.8. All other versions are working fine.
When you run mvn compile on the example project attached the following error is thrown:
[ERROR] Failed to execute goal org.codehaus.gmaven:gmaven-plugin:1.3:compile (default) on project GMavenTest: Execution default of goal org.codehaus.gmaven:gmaven-plugin:1.3:compile failed: An API incompatibility was encountered while executing org.codehaus.gmaven:gmaven-plugin:1.3:compile: java.lang.NoSuchMethodError: org.codehaus.groovy.control.SourceUnit.getSource()Lorg/codehaus/groovy/control/io/ReaderSource;
The full stacktrace is attached.
- Options
- Sort By Name
- Sort By Date
- Ascending
- Descending
- Download All
Attachments
-
- GMavenTest.tar.gz
- 18/Feb/11 2:47 AM
- 7 kB
- Marcel Szalbach
-
- stackTrace.txt
- 18/Feb/11 2:47 AM
- 22 kB
- Marcel Szalbach
Activity
-
All
Comments
Work Log
History
Activity
I found the solution or workaround(this plugin really needs a better documentation) for this problem with the new groovy version you need to add the groovy-runtime to the plugin dependencies. After this change I can also build groovy 1.8 modules.
<plugin> <groupId>org.codehaus.gmaven</groupId> <artifactId>gmaven-plugin</artifactId> <version>${gmaven.version}</version> <dependencies> <dependency> <groupId>org.codehaus.gmaven.runtime</groupId> <artifactId>gmaven-runtime-1.7</artifactId> <version>${gmaven.version}</version> </dependency> </dependencies> <executions> <execution> <goals> <goal>compile</goal> <goal>testCompile</goal> </goals> </execution> </executions> </plugin>
<plugin> <groupId>org.codehaus.gmaven</groupId> <artifactId>gmaven-plugin</artifactId> <version>${gmaven.version}</version> <dependencies> <dependency> <groupId>org.codehaus.gmaven.runtime</groupId> <artifactId>gmaven-runtime-1.7</artifactId> <version>${gmaven.version}</version> </dependency> </dependencies> <executions> <execution> <goals> <goal>compile</goal> <goal>testCompile</goal> </goals> </execution> </executions> </plugin>
I am also seeing this issue with Groovy 1.8.6, Maven 3.0.4, and GMaven 1.4
I published a project on GitHub which demonstrates the usage of the gmaven-plugin: https://github.com/vakuum/polyglot-java.
$ git clone https://github.com/vakuum/polyglot-java.git $ cd polyglot-java $ mvn clean install -DskipTests $ mvn exec:java --projects groovy $ cat all/src/main/java/polyglot/All.java $ mvn exec:java --projects all
Maybe helpful.
$ git clone https://github.com/vakuum/polyglot-java.git $ cd polyglot-java $ mvn clean install -DskipTests $ mvn exec:java --projects groovy $ cat all/src/main/java/polyglot/All.java $ mvn exec:java --projects all
The workaround is no longer needed now that 1.4 supports 1.8. I'm sorry that wasn't better documented at the time. I believe you'll find if you add
<properties> <gmavenProviderSelection>1.7</gmavenProviderSelection> ... </properties> <plugin> <groupId>org.codehaus.gmaven</groupId> <artifactId>gmaven-plugin</artifactId> ... <configuration> <providerSelection>${gmavenProviderSelection}</providerSelection> </configuration> </plugin>
It'll work just fine (it did for me anyway). You can do this instead of adding the gmaven-runtime dependency. Once I get done wrapping up a few things for the next release, I'll try to update the documentation to reflect this. If it doesn't work for some reason, leave a comment and I'll reopen.
<properties> <gmavenProviderSelection>1.7</gmavenProviderSelection> ... </properties> <plugin> <groupId>org.codehaus.gmaven</groupId> <artifactId>gmaven-plugin</artifactId> ... <configuration> <providerSelection>${gmavenProviderSelection}</providerSelection> </configuration> </plugin>
I have tested it and it works as expected. Thanks for the fix.
similar error when trying to compile 1.8.0-rc-1 :
Execution default of goal org.codehaus.gmaven:gmaven-plugin:1.3:compile failed: An API incompatibility was encountered while executing org.codehaus.gmaven:gmaven-plugin:1.3:compile: java.lang.NoSuchMethodError: org.codehaus.groovy.control.SourceUnit.getSource()Lorg/codehaus/groovy/control/io/ReaderSource;