Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No changes, but Mwe2Launcher throws NoSuchMethodError: ImmutableMap$Builder.buildOrThrow #255

Open
SimonCockx opened this issue Jun 26, 2023 · 5 comments

Comments

@SimonCockx
Copy link

SimonCockx commented Jun 26, 2023

Since today, our Maven build suddenly started failing with the following stacktrace:

0    ERROR Mwe2Launcher       - com.google.common.collect.ImmutableMap$Builder.buildOrThrow()Lcom/google/common/collect/ImmutableMap;
java.lang.NoSuchMethodError: com.google.common.collect.ImmutableMap$Builder.buildOrThrow()Lcom/google/common/collect/ImmutableMap;
        at com.google.inject.internal.MoreTypes.<clinit>(MoreTypes.java:61)
        at com.google.inject.TypeLiteral.<init>(TypeLiteral.java:83)
        at com.google.inject.TypeLiteral.get(TypeLiteral.java:150)
        at com.google.inject.internal.ProviderMethodsModule.<init>(ProviderMethodsModule.java:60)
        at com.google.inject.internal.ProviderMethodsModule.forObject(ProviderMethodsModule.java:93)
        at com.google.inject.internal.ProviderMethodsModule.forModule(ProviderMethodsModule.java:67)
        at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:435)
        at com.google.inject.spi.Elements.getElements(Elements.java:113)
        at com.google.inject.internal.InjectorShell$Builder.build(InjectorShell.java:160)
        at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:107)
        at com.google.inject.Guice.createInjector(Guice.java:87)
        at com.google.inject.Guice.createInjector(Guice.java:69)
        at com.google.inject.Guice.createInjector(Guice.java:59)
        at org.eclipse.emf.mwe2.language.Mwe2StandaloneSetupGenerated.createInjector(Mwe2StandaloneSetupGenerated.java:47)
        at org.eclipse.emf.mwe2.language.Mwe2StandaloneSetupGenerated.createInjectorAndDoEMFRegistration(Mwe2StandaloneSetupGenerated.java:41)
        at org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.run(Mwe2Launcher.java:75)
        at org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.main(Mwe2Launcher.java:36)
        at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:279)
        at java.base/java.lang.Thread.run(Thread.java:834)

I have run the Maven build in a clean environment and compared the log to a successful Maven build of exactly the same codebase from 5 days ago, see attachments. The only significant change I see is that the build fetches the newly released Xtext 2.32.0 from Maven Central, although I hope that doesn't influence the build in some way.

The code I'm building is from this PR (which did not change over the last 5 days)

2023.06.21-BuildDsl.txt
2023.06.26-BuildDsl.txt

I actually want to address two issues in this thread:

  1. How do I fix the immediate NoSuchMethodError at hand?
  2. Since the builds I compare stem from exactly the same code base, why is my build suddenly failing? Does Mwe2 somehow rely on external unversioned resources?
@SimonCockx
Copy link
Author

SimonCockx commented Jun 26, 2023

When debugging with -X, I see this dependency among the plugin dependencies that the exec-maven-plugin makes available to the Mwe2Launcher:

com.google.inject:guice:jar:7.0.0:runtime

This doesn't seem right, as Xtext 2.27.0 (the version I'm using) is using 5.0.1.

@SimonCockx
Copy link
Author

Adding the dependency

<dependency>
	<groupId>com.google.inject</groupId>
	<artifactId>guice</artifactId>
	<version>5.0.1</version>
</dependency>

to the plugin dependencies fixed the NoSuchMethodError.

@cdietrich
Copy link
Contributor

cdietrich commented Jun 26, 2023

@SimonCockx which versions of mwe/guava/guice do you use?
how do you configure the mwe execution? target platform?

Guice 7 + Guava 32 is correct with latest mwe milestone
=> maybe your xcore thing pulls ranges for stuff

@SimonCockx
Copy link
Author

SimonCockx commented Jun 26, 2023

@cdietrich All our version come from the xtext-dev-bom 2.27.0 (including mwe, guava and guice), which doesn't seem to use ranges.

Before I added the workaround, running mvn dependency:tree on my "xcore dependencies" project showed

[INFO] +- org.eclipse.emf:org.eclipse.emf.ecore.xcore:jar:1.23.0:compile
[INFO] |  +- org.eclipse.xtext:org.eclipse.xtext:jar:2.27.0:compile
[INFO] |  |  +- org.eclipse.xtend:org.eclipse.xtend.lib:jar:2.27.0:compile
[INFO] |  |  |  \- org.eclipse.xtend:org.eclipse.xtend.lib.macro:jar:2.27.0:compile
[INFO] |  |  \- com.google.inject:guice:jar:5.0.1:compile   <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
[INFO] |  |     +- javax.inject:javax.inject:jar:1:compile
[INFO] |  |     \- aopalliance:aopalliance:jar:1.0:compile

which seems right. I'm not sure where the 7.0.0:runtime dependency could be coming from.

@cdietrich
Copy link
Contributor

cdietrich commented Jun 27, 2023

This is about the exec part.
to my knowledge maven handles this differently

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants