Issue
Exploring the maven-jdeps-plugin:3.1.0
with Java9 using the following minimal pom.xml
:-
<dependencies>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.9.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>1.9</source>
<target>1.9</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jdeps-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<goals>
<goal>jdkinternals</goal> <!-- verify main classes -->
<goal>test-jdkinternals</goal> <!-- verify test classes -->
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
On executing
mvn install
I end up getting a detailed error that reads the following:-
[INFO] Error: log4j-api-2.9.0.jar is a multi-release jar file but --multi-release option is not set [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 3.389 s [INFO] Finished at: ... [INFO] Final Memory: 12M/41M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-jdeps-plugin:3.1.0:jdkinternals (default) on project maven-jigsaw: [ERROR] Exit code: 2 [ERROR] Command line was: /bin/sh -c '/Library/Java/JavaVirtualMachines/jdk-9.jdk/Contents/Home/bin/jdeps' '-cp' '.../.m2/repository/org/apache/logging/log4j/log4j-api/2.9.0/log4j-api-2.9.0.jar' '../maven/target/classes'
I couldn't find much relevance related to --multi-release
flag in either jdeps:jdkinternals
goal detailed on Maven's official site or even in the jdeps
tool documented at Oracle help center.
Can someone throw some light on this implementation in maven-jdeps-plugin
? Is there a way to fix this(set the --multi-release
option)?
Solution
This is user error. Please enter jdeps -? on the command line. You will see you need to enter
jdeps --multi-release 9 ~/.m2/repository/org/apache/logging/log4j/log4j-api/2.9.1/log4j-api-2.9.1.jar
Answered By - rgoers
Answer Checked By - David Marino (JavaFixing Volunteer)