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

m2e doesn't systematically use the jdk associated with the project to run mojos leading to inconstancies #1913

Open
andre-doherty opened this issue Jan 8, 2025 · 4 comments

Comments

@andre-doherty
Copy link

hello,

Following the #988 i have investigated on the com.sun.xml.ws:jaxws-maven-plugin behavior.
As far as i understand, the m2e plugin doesn't rely on the maven toolchain.
This is perfectly ok, however it appears that the jaxws-maven-plugin is not run using the project associated jdk but instead the eclipse jdk.
As the wsgen goal implies java source compilation and so bytecode generation, this leads to runtime errors when the project jdk and testing process are not aligned with the eclipse jdk.

image

You may want to use the following sample :
https://github.com/andre-doherty/sample-jaxws

And monitor the bytecode using this command :
watch -d -n 1 'find target -type f -name "GetAll*" | xargs file'

Using :
Eclipse.org Eclipse Platform 4.34.0.v20241120-1800 org.eclipse.platform
Eclipse.org - m2e M2E Maven Integration for Eclipse Core 2.7.0.20241126-1642 org.eclipse.m2e.feature

André

@kwin
Copy link
Member

kwin commented Jan 13, 2025

Look at https://github.com/eclipse-m2e/m2e-core/blob/master/RELEASE_NOTES.md#configuration-of-maven-execution-jre how the Maven JRE is selected and please explain why this doesn't work in your case.

@andre-doherty
Copy link
Author

hello @kwin,
Thank you for pointing me to that document.

So yes i realize i need to give some extra precision on how to reproduce the case.
This occurs during an build triggered by eclipse, eg updating / cleaning (Menu -> maven -> update project, Project -> clean).

Unless i am mistaken the setup you point is related to manual maven build, is that correct ?
(aka Run As -> M2e maven build ...).

By putting a breakpoint in the jaxws-maven-plugin wsgen mojo i am able to monitor which jdk is in used when it s executed.
It s not the jdk17 as one would expect but the jdk21 (eclipse one).
image

André

@kwin
Copy link
Member

kwin commented Jan 14, 2025

For the default build there is no forking, i.e. the same JRE as used for running Eclipse is used for executing Maven!

@andre-doherty
Copy link
Author

OK.
As maven toolchains are unsupported, are there any way to rely on the project JDK instead ?

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