maven-compiler-plugin icon indicating copy to clipboard operation
maven-compiler-plugin copied to clipboard

[MCOMPILER-444] Dependency that should be on modulepath sometime put on classpath

Open jira-importer opened this issue 5 years ago • 7 comments

Benjamin Marwell opened MCOMPILER-444 and commented

See https://issues.apache.org/jira/browse/MCOMPILER-336

I can still recreate this with a test dependency.

I believe the jakarta.activation module should have been on the module path, but is only on the classpath. This leads to this error:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:testCompile (default-testCompile) on project surefire-module-test: Compilation failure [ERROR] module not found: jakarta.activation

demo project: https://github.com/bmarwell/jaxrs-surefire-module-showcase

 


Affects: 3.8.1

jira-importer avatar Dec 11 '20 14:12 jira-importer

Benjamin Marwell commented

If I replace the jakarta-activation-api with javax.xml.bind:jaxb-api:2.3.1:provided,  compilation works.

 

(surefire stuff following)

If using no profile, surefire hangs (yay…).

Using cxf profile: VM crash

Using jersey/resteasy profile: module not found: java.xml.bind 

jira-importer avatar Dec 11 '20 16:12 jira-importer

Benjamin Marwell commented

If I instead use jakarta.xml.bind:jakarta.xml.bind-api:2.3.3:test, I get: [ERROR] module not found: java.xml.bind.

Huh…

jira-importer avatar Dec 11 '20 16:12 jira-importer

Robert Scholte commented

Comparing both module paths, it looks like the following line disappears during test-compile: [DEBUG] d:\maven_repo.m2\repository\jakarta\activation\jakarta.activation-api\1.2.2\jakarta.activation-api-1.2.2.jar

jira-importer avatar Dec 21 '20 19:12 jira-importer

Robert Scholte commented

Found the bug in https://github.com/codehaus-plexus/plexus-languages/blob/master/plexus-java/src/main/java/org/codehaus/plexus/languages/java/jpms/LocationManager.java#L215 With test dependencies, a second module with the name java.xml.bind is available: next to jakarta.xml.bind-api,jar there's now also a jaxb-api.jar. The first one should win, but with the current LocationManager the last one will win.

jira-importer avatar Dec 21 '20 20:12 jira-importer

Benjamin Marwell commented

Wow, that was enormously fast! Thanks a lot! I will wait as soon as there is a plexus-languages release and create a dep update commit here. Btw, is there a workaround?

jira-importer avatar Dec 21 '20 20:12 jira-importer

Robert Scholte commented

exclude jaxb-api?

jira-importer avatar Dec 21 '20 20:12 jira-importer

Benjamin Marwell commented

Ah, I tried that earlier but missed that I still had <debugForkedProcess>true</debugForkedProcess> active. 🤦🏻‍♂️ Thanks!

jira-importer avatar Dec 21 '20 21:12 jira-importer