Skip to content
This repository has been archived by the owner on Apr 21, 2023. It is now read-only.

java.lang.NoSuchMethodError: org.eclipse.jdt.internal.compiler.batch.FileSystem.getClasspath with xtend-maven-plugin:2.14.0 and jdt.core 3.14.0 instead of 3.13.102 #493

Closed
vorburger opened this issue Jul 3, 2018 · 26 comments
Milestone

Comments

@vorburger
Copy link
Contributor

while fiddling with eclipse/xtext#1231 for https://jira.opendaylight.org/browse/ODLPARENT-156 I've a few things, among them specifying org.eclipse.jdt:org.eclipse.jdt.core version 3.14.0, and this lead to:

[ERROR] Failed to execute goal org.eclipse.xtend:xtend-maven-plugin:2.14.0:compile (default) on project aclservice-impl: Execution default of goal org.eclipse.xtend:xtend-maven-plugin:2.14.0:compile failed: An API incompatibility was encountered while executing org.eclipse.xtend:xtend-maven-plugin:2.14.0:compile: java.lang.NoSuchMethodError: org.eclipse.jdt.internal.compiler.batch.FileSystem.getClasspath(Ljava/lang/String;Ljava/lang/String;ZLorg/eclipse/jdt/internal/compiler/env/AccessRuleSet;Ljava/lang/String;Ljava/util/Map;)Lorg/eclipse/jdt/internal/compiler/batch/FileSystem$Classpath;

I'm guessing that this is probably perfectly normal, as I'm mixing an "old" previously released Xtend version (2.14.0) with the barely a few days old just freshly pushed latest JDT Photon release (3.14.0), and that this will be fixed in a future Xtend version, but just thought I would let you guys know about this anyway. It's NOT blocking me, as just using jdt.core version 3.14.0 instead of 3.13.102 to work around eclipse/xtext#1231 is fine.

@cdietrich
Copy link
Member

cdietrich commented Jul 3, 2018

@vorburger can you please provide a complete stacktrace
for me it looks like you use a newer jdt.core with older jdt.compiler.tool or jdt.compiler.apt

@vorburger
Copy link
Contributor Author

can you please provide a complete stacktrace

sure, running mvn -X ... we find:

Caused by: java.lang.NoSuchMethodError: org.eclipse.jdt.internal.compiler.batch.FileSystem.getClasspath(Ljava/lang/String;Ljava/lang/String;ZLorg/eclipse/jdt/internal/compiler/env/AccessRuleSet;Ljava/lang/String;Ljava/util/Map;)Lorg/eclipse/jdt/internal/compiler/batch/FileSystem$Classpath;
    at org.eclipse.jdt.internal.compiler.apt.util.EclipseFileManager.addNewEntry (EclipseFileManager.java:1204)
    at org.eclipse.jdt.internal.compiler.apt.util.EclipseFileManager.processPathEntries (EclipseFileManager.java:1018)
    at org.eclipse.jdt.internal.compiler.apt.util.EclipseFileManager.getPathsFrom (EclipseFileManager.java:293)
    at org.eclipse.jdt.internal.compiler.apt.util.EclipseFileManager.handleOption (EclipseFileManager.java:690)
    at org.eclipse.jdt.internal.compiler.apt.dispatch.BatchProcessingEnvImpl.<init> (BatchProcessingEnvImpl.java:88)
    at org.eclipse.jdt.internal.compiler.apt.dispatch.BatchAnnotationProcessorManager.configure (BatchAnnotationProcessorManager.java:75)
    at org.eclipse.jdt.internal.compiler.batch.Main.initializeAnnotationProcessorManager (Main.java:4556)
    at org.eclipse.jdt.internal.compiler.batch.Main.performCompilation (Main.java:4672)
    at org.eclipse.jdt.internal.compiler.batch.Main.compile (Main.java:1778)
    at org.eclipse.jdt.internal.compiler.batch.Main.compile (Main.java:1461)
    at org.eclipse.jdt.core.compiler.batch.BatchCompiler.compile (BatchCompiler.java:80)
    at org.eclipse.jdt.core.compiler.batch.BatchCompiler.compile (BatchCompiler.java:52)
    at org.eclipse.xtend.core.compiler.batch.XtendBatchCompiler.preCompile (XtendBatchCompiler.java:655)
    at org.eclipse.xtend.core.compiler.batch.XtendBatchCompiler.preCompileJava (XtendBatchCompiler.java:619)
    at org.eclipse.xtend.core.compiler.batch.XtendBatchCompiler.compile (XtendBatchCompiler.java:489)
    at org.eclipse.xtend.maven.AbstractXtendCompilerMojo.compile (AbstractXtendCompilerMojo.java:174)
    at org.eclipse.xtend.maven.XtendCompile.internalExecute (XtendCompile.java:62)
    at org.eclipse.xtend.maven.AbstractXtendMojo.execute (AbstractXtendMojo.java:39)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:134)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:208)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:309)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:194)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:107)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:955)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:290)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:194)
    at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)

and I guess this could be interesting:

realm =    plugin>org.eclipse.xtend:xtend-maven-plugin:2.14.0
strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
urls[0] = file:/home/vorburger/.m2/repository/org/eclipse/xtend/xtend-maven-plugin/2.14.0/xtend-maven-plugin-2.14.0.jar
urls[1] = file:/home/vorburger/.m2/repository/org/eclipse/jdt/org.eclipse.jdt.core/3.14.0/org.eclipse.jdt.core-3.14.0.jar
urls[2] = file:/home/vorburger/.m2/repository/org/eclipse/platform/org.eclipse.core.resources/3.13.0/org.eclipse.core.resources-3.13.0.jar
urls[3] = file:/home/vorburger/.m2/repository/org/eclipse/platform/org.eclipse.core.expressions/3.6.100/org.eclipse.core.expressions-3.6.100.jar
urls[4] = file:/home/vorburger/.m2/repository/org/eclipse/platform/org.eclipse.core.runtime/3.14.0/org.eclipse.core.runtime-3.14.0.jar
urls[5] = file:/home/vorburger/.m2/repository/org/eclipse/platform/org.eclipse.osgi/3.13.0/org.eclipse.osgi-3.13.0.jar
urls[6] = file:/home/vorburger/.m2/repository/org/eclipse/platform/org.eclipse.equinox.common/3.10.0/org.eclipse.equinox.common-3.10.0.jar
urls[7] = file:/home/vorburger/.m2/repository/org/eclipse/platform/org.eclipse.core.jobs/3.10.0/org.eclipse.core.jobs-3.10.0.jar
urls[8] = file:/home/vorburger/.m2/repository/org/eclipse/platform/org.eclipse.equinox.registry/3.8.0/org.eclipse.equinox.registry-3.8.0.jar
urls[9] = file:/home/vorburger/.m2/repository/org/eclipse/platform/org.eclipse.equinox.preferences/3.7.100/org.eclipse.equinox.preferences-3.7.100.jar
urls[10] = file:/home/vorburger/.m2/repository/org/eclipse/platform/org.eclipse.core.contenttype/3.7.0/org.eclipse.core.contenttype-3.7.0.jar
urls[11] = file:/home/vorburger/.m2/repository/org/eclipse/platform/org.eclipse.equinox.app/1.3.500/org.eclipse.equinox.app-1.3.500.jar
urls[12] = file:/home/vorburger/.m2/repository/org/eclipse/platform/org.eclipse.core.filesystem/1.7.100/org.eclipse.core.filesystem-1.7.100.jar
urls[13] = file:/home/vorburger/.m2/repository/org/eclipse/platform/org.eclipse.text/3.6.300/org.eclipse.text-3.6.300.jar
urls[14] = file:/home/vorburger/.m2/repository/org/eclipse/platform/org.eclipse.core.commands/3.9.100/org.eclipse.core.commands-3.9.100.jar
urls[15] = file:/home/vorburger/.m2/repository/com/google/guava/guava/22.0-rc1-android/guava-22.0-rc1-android.jar
urls[16] = file:/home/vorburger/.m2/repository/com/google/code/findbugs/jsr305/1.3.9/jsr305-1.3.9.jar
urls[17] = file:/home/vorburger/.m2/repository/com/google/errorprone/error_prone_annotations/2.0.18/error_prone_annotations-2.0.18.jar
urls[18] = file:/home/vorburger/.m2/repository/com/google/j2objc/j2objc-annotations/1.1/j2objc-annotations-1.1.jar
urls[19] = file:/home/vorburger/.m2/repository/org/codehaus/mojo/animal-sniffer-annotations/1.14/animal-sniffer-annotations-1.14.jar
urls[20] = file:/home/vorburger/.m2/repository/org/eclipse/xtend/org.eclipse.xtend.core/2.14.0/org.eclipse.xtend.core-2.14.0.jar
urls[21] = file:/home/vorburger/.m2/repository/org/eclipse/jdt/org.eclipse.jdt.compiler.apt/1.3.110/org.eclipse.jdt.compiler.apt-1.3.110.jar
urls[22] = file:/home/vorburger/.m2/repository/org/eclipse/jdt/org.eclipse.jdt.compiler.tool/1.2.101/org.eclipse.jdt.compiler.tool-1.2.101.jar
urls[23] = file:/home/vorburger/.m2/repository/org/eclipse/xtext/org.eclipse.xtext.xbase/2.14.0/org.eclipse.xtext.xbase-2.14.0.jar
urls[24] = file:/home/vorburger/.m2/repository/org/eclipse/xtext/org.eclipse.xtext.common.types/2.14.0/org.eclipse.xtext.common.types-2.14.0.jar
urls[25] = file:/home/vorburger/.m2/repository/org/eclipse/xtext/org.eclipse.xtext.xbase.lib/2.14.0/org.eclipse.xtext.xbase.lib-2.14.0.jar
urls[26] = file:/home/vorburger/.m2/repository/org/eclipse/xtext/org.eclipse.xtext.util/2.14.0/org.eclipse.xtext.util-2.14.0.jar
urls[27] = file:/home/vorburger/.m2/repository/org/eclipse/xtext/org.eclipse.xtext.smap/2.14.0/org.eclipse.xtext.smap-2.14.0.jar
urls[28] = file:/home/vorburger/.m2/repository/org/eclipse/xtext/org.eclipse.xtext/2.14.0/org.eclipse.xtext-2.14.0.jar
urls[29] = file:/home/vorburger/.m2/repository/org/eclipse/xtend/org.eclipse.xtend.lib/2.14.0/org.eclipse.xtend.lib-2.14.0.jar
urls[30] = file:/home/vorburger/.m2/repository/org/eclipse/xtend/org.eclipse.xtend.lib.macro/2.14.0/org.eclipse.xtend.lib.macro-2.14.0.jar
urls[31] = file:/home/vorburger/.m2/repository/org/eclipse/emf/org.eclipse.emf.common/2.12.0/org.eclipse.emf.common-2.12.0.jar
urls[32] = file:/home/vorburger/.m2/repository/org/eclipse/emf/org.eclipse.emf.ecore/2.12.0/org.eclipse.emf.ecore-2.12.0.jar
urls[33] = file:/home/vorburger/.m2/repository/com/google/inject/guice/3.0/guice-3.0.jar
urls[34] = file:/home/vorburger/.m2/repository/aopalliance/aopalliance/1.0/aopalliance-1.0.jar
urls[35] = file:/home/vorburger/.m2/repository/log4j/log4j/1.2.16/log4j-1.2.16.jar
urls[36] = file:/home/vorburger/.m2/repository/org/ow2/asm/asm-commons/6.1.1/asm-commons-6.1.1.jar
urls[37] = file:/home/vorburger/.m2/repository/org/ow2/asm/asm/6.1.1/asm-6.1.1.jar
urls[38] = file:/home/vorburger/.m2/repository/org/ow2/asm/asm-tree/6.1.1/asm-tree-6.1.1.jar
urls[39] = file:/home/vorburger/.m2/repository/org/ow2/asm/asm-analysis/6.1.1/asm-analysis-6.1.1.jar
urls[40] = file:/home/vorburger/.m2/repository/org/eclipse/aether/aether-util/1.0.0.v20140518/aether-util-1.0.0.v20140518.jar
urls[41] = file:/home/vorburger/.m2/repository/javax/enterprise/cdi-api/1.0/cdi-api-1.0.jar
urls[42] = file:/home/vorburger/.m2/repository/org/eclipse/sisu/org.eclipse.sisu.inject/0.3.0.M1/org.eclipse.sisu.inject-0.3.0.M1.jar
urls[43] = file:/home/vorburger/.m2/repository/org/sonatype/sisu/sisu-guice/3.2.3/sisu-guice-3.2.3-no_aop.jar
urls[44] = file:/home/vorburger/.m2/repository/org/codehaus/plexus/plexus-interpolation/1.21/plexus-interpolation-1.21.jar
urls[45] = file:/home/vorburger/.m2/repository/org/codehaus/plexus/plexus-utils/3.0.20/plexus-utils-3.0.20.jar
urls[46] = file:/home/vorburger/.m2/repository/org/codehaus/plexus/plexus-component-annotations/1.5.5/plexus-component-annotations-1.5.5.jar
urls[47] = file:/home/vorburger/.m2/repository/org/sonatype/plexus/plexus-sec-dispatcher/1.3/plexus-sec-dispatcher-1.3.jar
urls[48] = file:/home/vorburger/.m2/repository/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar
urls[49] = file:/home/vorburger/.m2/repository/org/eclipse/emf/org.eclipse.emf.ecore.xmi/2.12.0/org.eclipse.emf.ecore.xmi-2.12.0.jar
urls[50] = file:/home/vorburger/.m2/repository/org/antlr/antlr-runtime/3.2/antlr-runtime-3.2.jar
urls[51] = file:/home/vorburger/.m2/repository/org/eclipse/emf/org.eclipse.emf.codegen/2.11.0-v20150806-0404/org.eclipse.emf.codegen-2.11.0-v20150806-0404.jar
Number of foreign imports: 1
import: Entry[import  from realm ClassRealm[project>org.opendaylight.netvirt:aclservice-impl:0.7.0-SNAPSHOT, parent: ClassRealm[maven.api, parent: null]]]

@cdietrich cdietrich added this to the Release_2.15 milestone Jul 3, 2018
@cdietrich
Copy link
Member

urls[21] = file:/home/vorburger/.m2/repository/org/eclipse/jdt/org.eclipse.jdt.compiler.apt/1.3.110/org.eclipse.jdt.compiler.apt-1.3.110.jar
urls[22] = file:/home/vorburger/.m2/repository/org/eclipse/jdt/org.eclipse.jdt.compiler.tool/1.2.101/org.eclipse.jdt.compiler.tool-1.2.101.jar
are from oxygen 3a
wonder how you got that mixed with the newer jdt.

@vorburger
Copy link
Contributor Author

are from oxygen 3a / wonder how you got that mixed with the newer jdt

dunno... don't see us fixing those in our parent POM here, and I don't see anything (obvious) which could be related to this jump out at me in this effective POM here.

If you have reason to suspect that this is problem is due to some version mismatch combination in this particular project, and not a general issue with "pure" (only) Xtend, then please do feel absolutely free to close this issue.

@cdietrich
Copy link
Member

well the problem is that platform and jdt maven poms are full of bad ranges and we have to find a way to "correct" that in our gradle and maven dependencies

@cdietrich
Copy link
Member

=> if you inc jdt.core you need to inc compiler.tool and compiler.apt too

@vorburger
Copy link
Contributor Author

if you inc jdt.core you need to inc compiler.tool and compiler.apt too

but only with 3.14.0, it seems? (it's fine withou with 3.13.102). OK so then let me close this issue. Please re-open if I misunderstood and there is actually something which needs to be done.

@LorenzoBettini
Copy link
Contributor

I'm experiencing the same problem with xtext-maven-plugin 2.15.0: https://travis-ci.org/LorenzoBettini/javamm/builds/433411433

can it be something similar to eclipse/xtext#1231 ?

@cdietrich
Copy link
Member

cdietrich commented Sep 26, 2018

i am sure that you accidentially pick bad version combinations. can you please give a list of what you pick? e.g. why is org.eclipse.jdt.core 3.15 picked? why are multiple versions of compiler.apt/tool picked?

@LorenzoBettini
Copy link
Contributor

The configuration is quite simple, and in the very current version can be found here https://github.com/LorenzoBettini/javamm/blob/cfff136dacb293f96227e34b6443aece1fbf97c8/javamm.examples/pom.xml where I also tried to add a dep on xtend.core, which, from what I understand, has the pinned version of jdt, but that doesn't change anything and I still get the problem...

I'm using tycho 1.2.0 and xtext 2.15.0 (TP is 2018-09).

@cdietrich
Copy link
Member

cdietrich commented Sep 26, 2018

yes but this mixes a big pile of tycho and maven dependencies which dont fit together. so no wonder.
and what is most annoying that tycho really sucks when it comes to fragments and mix stuff from maven and tycho

@LorenzoBettini
Copy link
Contributor

so I simply can't use xtext-maven-plugin I guess... or could I try something else?

@cdietrich
Copy link
Member

no the problem is this:

</configuration>
				<dependencies>
					<dependency>
						<groupId>javamm</groupId>
						<artifactId>javamm</artifactId>
						<version>${project.version}</version>
					</dependency>
					<dependency>
						<groupId>net.sf.xtext-jbase</groupId>
						<artifactId>jbase</artifactId>
						<version>${jbase-version}</version>
					</dependency>
					<dependency>
						<groupId>org.eclipse.xtend</groupId>
						<artifactId>org.eclipse.xtend.core</artifactId>
						<version>${xtextVersion}</version>
					</dependency>
</dependencies>

what about making sure that tycho and maven depenencies match or you use excludes/includes whatever(the part tycho sucks)

@LorenzoBettini
Copy link
Contributor

My deps have not further deps so I don't think they're the problem... from the stacktrace it looks like xtext-maven-plugin is trying to use a method from jdt.core which is not there anymore

Execution default of goal org.eclipse.xtext:xtext-maven-plugin:2.15.0:generate failed: An API incompatibility was encountered while executing org.eclipse.xtext:xtext-maven-plugin:2.15.0:generate: java.lang.NoSuchMethodError: org.eclipse.jdt.internal.compiler.batch.FileSystem.getClasspath(Ljava/lang/String;Ljava/lang/String;ZLorg/eclipse/jdt/internal/compiler/env/AccessRuleSet;Ljava/lang/String;Ljava/util/Map;)Lorg/eclipse/jdt/internal/compiler/batch/FileSystem$Classpath;

and even trying to force jdt.core to previous versions like 3.13.102 doesn't seem to help...

that's why I was guessing it's a problem in xtext-maven-plugin, but I've just realized that this very issue is against xtend, so should I open a new one for xtext-maven-plugin?

I haven't tried, but I guess this could be reproduced with https://github.com/xtext/maven-xtext-example switching to xtext 2.15...

@cdietrich
Copy link
Member

cdietrich commented Sep 26, 2018

this happens when a stoneage old compiler.tol/apt is used with a newer jdt.core

problem is tycho: how can you tell tycho to use that? did you do it? did you change the target platform?

can you simply try to

(1) explicitely set used jdt.core, compiler.tool and compiler.apt version to the latest gratest from 2018-09

@LorenzoBettini
Copy link
Contributor

I've already tried with jdt.core 2.15.0 (as a maven dep to xtext-maven-plugin, I guess that's what you suggested right?) but it fails as well, and not surprisingly since that method, with that signature, has been removed...

@LorenzoBettini
Copy link
Contributor

On the very contrary: it's jdt.core file:/home/travis/.m2/repository/p2/osgi/bundle/org.eclipse.jdt.core/3.15.0.v20180905-0317/org.eclipse.jdt.core-3.15.0.v20180905-0317.jar which is a p2 dep that gets into the way and breaks everything from what I understand...

@cdietrich
Copy link
Member

yes this is what i try to tell you all the time ......

@cdietrich
Copy link
Member

=> my idea: use jdt.core/compiler.apt/tool from 2018-09 as maven dependencies explicitely and see what happens.

@LorenzoBettini
Copy link
Contributor

OK, got it...

with

<dependency>
	<groupId>org.eclipse.jdt</groupId>
	<artifactId>org.eclipse.jdt.core</artifactId>
	<version>3.15.0</version>
</dependency>
<dependency>
	<groupId>org.eclipse.jdt</groupId>
	<artifactId>org.eclipse.jdt.compiler.apt</artifactId>
	<version>1.3.300</version>
</dependency>
<dependency>
	<groupId>org.eclipse.jdt</groupId>
	<artifactId>org.eclipse.jdt.compiler.tool</artifactId>
	<version>1.2.300</version>
</dependency>

it finally works!

But I don't understand why the workaround for xtend-maven-plugin was to use older versions of jdt...

so that was an unrelated issue I guess.

BTW: thanks :)

@cdietrich
Copy link
Member

well it could happen that jdt never broke the code between different versions so it will have worked randomly/by luck

@LorenzoBettini
Copy link
Contributor

mh... but then who's calling that jdt method in the end?

@kthoms
Copy link

kthoms commented Sep 26, 2018

We really should pin the versions of every dependency in the xtend-maven-plugin to avoid such trouble. It is very unusual for a Maven plugin that there is any ranged (transitive) dependency.

@cdietrich
Copy link
Member

cdietrich commented Sep 26, 2018

No this is the xtext maven plugin when
Using tycho and non tycho mixed
Pinning does not help
man problem seems to be that fragment resolving behaviour is wired and an "old" fragment is used from tycho or none at all

@cdietrich
Copy link
Member

i propose to close this as wont fix.
the bom stuff we do and the pinning in 2.15 is a we can and could do

@szarnekow
Copy link
Contributor

Please reopen if there is a better plan or additional information to be taken into account.

rmitin pushed a commit to dsldevkit/dsl-devkit that referenced this issue Dec 20, 2018
Our builds take latest Xtend compiler. JDT API changed, Xtend compiler
fails. So we need to fix the JDT compiler version.

See eclipse/xtext-xtend#493 for details
rmitin added a commit to dsldevkit/dsl-devkit that referenced this issue Dec 20, 2018
Our builds take latest Xtend compiler. JDT API changed, Xtend compiler
fails. So we need to fix the JDT compiler version.

See eclipse/xtext-xtend#493 for details
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants