apache / apache/maven-jdeps-plugin
[MJDEPS-20] jdeps for modularized code should use --module-path
- Dominant language
- Java
- Stars
- 18
- Forks
- 18
- Avg merge
- 9h 12m
- Merged PRs (30d)
- 5
Description
**[Andre Tadeu de Carvalho](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=andretadeu)** opened **[MJDEPS-20](https://issues.apache.org/jira/browse/MJDEPS-20?redirect=false)** and commented
In the attempt to solve https://issues.apache.org/jira/browse/MJDEPS-16, I discover that the plugin is not settings **--module-path** when the code is modularized. It also need to set the target to _target/classes/module-info.class_ instead _target/classes_.
As an example in https://github.com/andretadeu/maven-jdeps-plugin.git, branch MJDEPS-16, running the test **MJDEPS-16_jdkinternals**:
```
jdeps --module-path /com/google/inject/guice/4.2.0/guice-4.2.0.jar:/javax/inject/javax.inject/1/javax.inject-1.jar:/aopalliance/aopalliance/1.0/aopalliance-1.0.jar:/com/google/guava/guava/25.1-jre/guava-25.1-jre.jar:/com/google/code/findbugs/jsr305/3.0.2/jsr305-3.0.2.jar:/org/checkerframework/checker-qual/2.0.0/checker-qual-2.0.0.jar:/com/google/errorprone/error_prone_annotations/2.1.3/error_prone_annotations-2.1.3.jar:/com/google/j2objc/j2objc-annotations/1.1/j2objc-annotations-1.1.jar:/org/codehaus/mojo/animal-sniffer-annotations/1.14/animal-sniffer-annotations-1.14.jar -jdkinternals /target/it/MJDEPS-16_jdkinternals/target/classes/module-info.class
```
should return:
```java
com.google.common automatic
[file:///home/andre/workspaces/oss/maven-jdeps-plugin/target/local-repo/com/google/guava/guava/25.1-jre/guava-25.1-jre.jar]
requires mandated java.base
com.google.common -> jdk.unsupported
com.google.common.cache.Striped64 -> sun.misc.Unsafe JDK internal API (jdk.unsupported)
com.google.common.cache.Striped64$1 -> sun.misc.Unsafe JDK internal API (jdk.unsupported)
com.google.common.cache.Striped64$Cell -> sun.misc.Unsafe JDK internal API (jdk.unsupported)
com.google.common.hash.LittleEndianByteArray$UnsafeByteArray -> sun.misc.Unsafe JDK internal API (jdk.unsupported)
com.google.common.hash.LittleEndianByteArray$UnsafeByteArray$1 -> sun.misc.Unsafe JDK internal API (jdk.unsupported)
com.google.common.hash.LittleEndianByteArray$UnsafeByteArray$2 -> sun.misc.Unsafe JDK internal API (jdk.unsupported)
com.google.common.hash.LittleEndianByteArray$UnsafeByteArray$3 -> sun.misc.Unsafe JDK internal API (jdk.unsupported)
com.google.common.hash.Striped64 -> sun.misc.Unsafe JDK internal API (jdk.unsupported)
com.google.common.hash.Striped64$1 -> sun.misc.Unsafe JDK internal API (jdk.unsupported)
com.google.common.hash.Striped64$Cell -> sun.misc.Unsafe JDK internal API (jdk.unsupported)
com.google.common.primitives.UnsignedBytes$LexicographicalComparatorHolder$UnsafeComparator -> sun.misc.Unsafe JDK internal API (jdk.unsupported)
com.google.common.primitives.UnsignedBytes$LexicographicalComparatorHolder$UnsafeComparator$1 -> sun.misc.Unsafe JDK internal API (jdk.unsupported)
com.google.common.util.concurrent.AbstractFuture$UnsafeAtomicHelper -> sun.misc.Unsafe JDK internal API (jdk.unsupported)
com.google.common.util.concurrent.AbstractFuture$UnsafeAtomicHelper$1 -> sun.misc.Unsafe JDK internal API (jdk.unsupported)
Warning: JDK internal APIs are unsupported and private to JDK implementation that are
subject to be removed or changed incompatibly and could break your application.
Please modify your code to eliminate dependence on any JDK internal APIs.
For the most recent update on JDK internal API replacements, please check:
https://wiki.openjdk.java.net/display/JDK8/Java+Dependency+Analysis+Tool
JDK Internal API Suggested Replacement
---------------- ---------------------
sun.misc.Unsafe See http://openjdk.java.net/jeps/260
```
If the code is not modularized, it should keep using **-cp** instead of **--module-path** and it will point to _target/classes**_. If jdeps command is using **--module-path**, it should point to **module-info.class**, or the command won't return a single line.
---
**Affects:** 3.1.2
**Issue Links:**
- [MJDEPS-19](https://issues.apache.org/jira/browse/MJDEPS-19) jdeps with -m with error on module
(_**"duplicates"**_)
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the maven-jdeps-plugin behavior exercised by the MJDEPS-16_jdkinternals integration test and compare it with the jdeps command shown in the issue. Done means modularized code uses --module-path with target/classes/module-info.class, while non-modularized code continues using -cp with target/classes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100