Details
-
Type:
Bug
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: 2.5.1Release
-
Fix Version/s: None
-
Component/s: Compiler Integration, Maven integration
-
Labels:None
-
Environment:HideApache Maven 3.0.3 (r1075438; 2011-02-28 18:31:09+0100)
Maven home: C:\java\apache-maven-3.0.3\
Java version: 1.6.0, vendor: IBM Corporation
Java home: C:\Program Files\IBM\SDP\jdk\jre
Default locale: no_NO, platform encoding: Cp1252
OS name: "windows xp", version: "5.1 build 2600 service pack 2", arch: "x86", family: "windows"ShowApache Maven 3.0.3 (r1075438; 2011-02-28 18:31:09+0100) Maven home: C:\java\apache-maven-3.0.3\ Java version: 1.6.0, vendor: IBM Corporation Java home: C:\Program Files\IBM\SDP\jdk\jre Default locale: no_NO, platform encoding: Cp1252 OS name: "windows xp", version: "5.1 build 2600 service pack 2", arch: "x86", family: "windows"
-
Testcase included:yes
-
Number of attachments :
Description
When using groovy-eclipse-compiler with Maven command line and an IBM JDK the maven-compiler-plugin fails with the following error message
(I'm using groovy-eclipse-compiler 2.5.1-M3, because of http://jira.codehaus.org/browse/GRECLIPSE-1142)
Caused by: org.apache.maven.plugin.PluginContainerException: A required class was missing while executing org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile: org.eclipse.core.runtime.content.IContentTypeManager$IContentTypeChangeListener
-----------------------------------------------------
realm = plugin>org.apache.maven.plugins:maven-compiler-plugin:2.3.2
strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
urls[0] = file:/c:/.m2/repository/org/apache/maven/plugins/maven-compiler-plugin/2.3.2/maven-compiler-plugin-2.3.2.jar
urls[1] = file:/c:/.m2/repository/org/codehaus/groovy/groovy-eclipse-compiler/2.5.1-M3/groovy-eclipse-compiler-2.5.1-M3.
jar
urls[2] = file:/c:/.m2/repository/org/codehaus/groovy/groovy-eclipse-batch/1.8.0-03/groovy-eclipse-batch-1.8.0-03.jar
urls[3] = file:/c:/.m2/repository/org/apache/xbean/xbean-reflect/3.4/xbean-reflect-3.4.jar
urls[4] = file:/c:/.m2/repository/log4j/log4j/1.2.12/log4j-1.2.12.jar
urls[5] = file:/c:/.m2/repository/commons-logging/commons-logging-api/1.1/commons-logging-api-1.1.jar
urls[6] = file:/c:/.m2/repository/com/google/collections/google-collections/1.0/google-collections-1.0.jar
urls[7] = file:/c:/.m2/repository/junit/junit/3.8.2/junit-3.8.2.jar
urls[8] = file:/c:/.m2/repository/org/codehaus/plexus/plexus-utils/2.0.5/plexus-utils-2.0.5.jar
urls[9] = file:/c:/.m2/repository/org/codehaus/plexus/plexus-compiler-api/1.8.1/plexus-compiler-api-1.8.1.jar
urls[10] = file:/c:/.m2/repository/org/codehaus/plexus/plexus-compiler-manager/1.8.1/plexus-compiler-manager-1.8.1.jar
urls[11] = file:/c:/.m2/repository/org/codehaus/plexus/plexus-compiler-javac/1.8.1/plexus-compiler-javac-1.8.1.jar
Number of foreign imports: 1
import: Entry[import from realm ClassRealm[maven.api, parent: null]]
-----------------------------------------------------
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:125)
... 20 more
Caused by: java.lang.NoClassDefFoundError: org.eclipse.core.runtime.content.IContentTypeManager$IContentTypeChangeListener
at java.lang.ClassLoader.defineClassImpl(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:275)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:69)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:529)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:440)
at java.net.URLClassLoader.access$300(URLClassLoader.java:68)
at java.net.URLClassLoader$ClassFinder.run(URLClassLoader.java:1023)
at java.security.AccessController.doPrivileged(AccessController.java:284)
at java.net.URLClassLoader.findClass(URLClassLoader.java:418)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClassFromSelf(ClassRealm.java:386)
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:42)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:244)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:230)
at java.lang.J9VMInternals.verifyImpl(Native Method)
at java.lang.J9VMInternals.verify(J9VMInternals.java:72)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:134)
at org.codehaus.jdt.groovy.integration.LanguageSupportFactory.tryInstantiate(LanguageSupportFactory.java:128)
I have attached a simple test project which will work when compiling (mvn compile) with a Sun/Oracle jdk, but will fail with a IBM jdk. When imported into eclipse (with groovy-eclipse plugin) everything compiles no matter what jdk is used. Included in the test project is a java test case which will force the NoClassDefFoundError given above. The error stems from org.codehaus.jdt.groovy.integration.LanguageSupportFactory.tryInstantiate()'s line
JavaCore javaCore = JavaCore.getJavaCore();
The JavaCore-class imports org.eclipse.jdt.internal.core.JavaModelManager, which implements IContentTypeManager.IContentTypeChangeListener. The latter class is not included in the groovy-eclipse-batch jar-file. A possible workaround is to add the following dependency:
<dependency>
<groupId>org.eclipse.core</groupId>
<artifactId>org.eclipse.core.contenttype</artifactId>
<version>3.4.100.v20100505-1235</version>
</dependency>
(when verbosing class loading with a Sun/Oracle jdk the JavaModelManager is never loaded. Is the Sun/Oracle jdk's class loading fundamentally different from IBM's? Lazy class loading of some kind?)