[
https://issues.apache.org/jira/browse/MSHADE-398?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17374109#comment-17374109
]
Alexander Kriegisch edited comment on MSHADE-398 at 7/3/21, 5:53 PM:
---------------------------------------------------------------------
Like I said, I am not knowlegeable around Invoker, but pretty sure that there
is a setting to tweak it the right way. As for a command line, I am lazy and
simply added {{<invokerTest>setup-parent,MSHADE-185</invokerTest>}} to the
Invoker config in the POM, then calling {{mvn verify}}. _(Sorry for Jira
striking through what it thinks is a closed issue reference.)_
Update: I run the tests from within the IDE, yes, but still via Maven.
was (Author: kriegaex):
Like I said, I am not knowlegeable around Invoker, but pretty sure that there
is a setting to tweak it the right way. As for a command line, I am lazy and
simply added {{<invokerTest>setup-parent,MSHADE-185</invokerTest>}} to the
Invoker config in the POM, then calling {{mvn verify}}. _(Sorry for Jira
striking through what it thinks is a closed issue reference.)_
> MSHADE-185 IT failing if JAVA_HOME != JDK version running the test
> ------------------------------------------------------------------
>
> Key: MSHADE-398
> URL: https://issues.apache.org/jira/browse/MSHADE-398
> Project: Maven Shade Plugin
> Issue Type: Bug
> Affects Versions: 3.2.4
> Reporter: Alexander Kriegisch
> Priority: Major
>
> Maven Invoker regression integration test (IT) {{MSHADE-185}} runs only on
> JDK <= 8. The CI builds on GitHub are fine, because they run on JDK 8 and
> also set {{JAVA_HOME}} accordingly. But on many systems, e.g. my developer
> workstation, {{JAVA_HOME}} points to a more recent JDK like 9, 11, 16. Those
> JDKs do not contain {{tools.jar}}, of course. So far, so good.
> Now it is perfectly normal that a developer starts an IDE and from there
> loads her project and runs the Maven Shade build, selecting a different JDK
> to run Maven on, because for example they want to run all ITs. The same can
> happen in a console, if the developer starts Maven on a different Java
> executable than the one pointed to by {{JAVA_HOME}}. In both cases, the test
> fails, because the POM contains a system dependency on {{tools.jar}}.
> First the Maven build started by Invoker fails:
> {code:java}
> [ERROR] Failed to execute goal on project system-dep: Could not resolve
> dependencies for project test.shade:system-dep:jar:1.0.0-SNAPSHOT: Could not
> find artifact com.sun:tools:jar:1.6 at specified path c:\Program
> Files\Java\jdk-16\..\lib\tools.jar -> [Help 1]
> org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute
> goal on project system-dep: Could not resolve dependencies for project
> test.shade:system-dep:jar:1.0.0-SNAPSHOT: Could not find artifact
> com.sun:tools:jar:1.6 at specified path c:\Program
> Files\Java\jdk-16\..\lib\tools.jar
> at
> org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.getDependencies
> (LifecycleDependencyResolver.java:269)
> at
> org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.resolveProjectDependencies
> (LifecycleDependencyResolver.java:147)
> at
> org.apache.maven.lifecycle.internal.MojoExecutor.ensureDependenciesAreResolved
> (MojoExecutor.java:248)
> at org.apache.maven.lifecycle.internal.MojoExecutor.execute
> (MojoExecutor.java:202)
> {code}
> Then later of course also the post-run verify step fails, because no
> dependency-reduced POM was created due to the fact that the build failed
> quickly:
> {code:java}
> Running post-build script:
> C:\Users\alexa\Documents\java-src\maven-shade-plugin\target\it\MSHADE-185\verify.groovy
> Assertion failed:
> assert pomFile.isFile()
> | |
> | false
>
> C:\Users\alexa\Documents\java-src\maven-shade-plugin\target\it\MSHADE-185\dependency-reduced-pom.xml
> {code}
> The solution would be to make sure that Invoker sets JAVA_HOME according to
> the JDK actually used for running the test. I have not investigated how to do
> that, but it should be possible somehow.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)