3

I found the module attribute on the official documentation of the maven-jdeps-plugin which states that

Show module containing the package

  • Type: boolean
  • Since: JDK 1.9.0
  • Required: No
  • User Property: jdeps.module
  • Default: false

Trying to make use of it with the current minimal pom.xml as follows:-

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.7.0</version>
            <configuration>
                <source>9</source>
                <target>9</target>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jdeps-plugin</artifactId>
            <version>3.1.0</version>
            <configuration>
                <apiOnly>false</apiOnly>
                <failOnWarning>true</failOnWarning>
                <module>true</module>
            </configuration>
            <executions>
                <execution>
                    <goals>
                        <goal>jdkinternals</goal> <!-- verify main classes -->
                        <goal>test-jdkinternals</goal> <!-- verify test classes -->
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

The build of my project(named sparkjdk9) on executing

mvn clean install

results into these logs:-

[INFO] --- maven-jdeps-plugin:3.1.0:jdkinternals (default) @ sparkjdk9 ---
[INFO] 
Error: unknown option: -M
Usage: jdeps <options> <path ...>]
use -h, -?, -help, or --help for a list of possible options
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.649 s
[INFO] Finished at: ...
[INFO] Final Memory: 13M/44M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-jdeps-plugin:3.1.0:jdkinternals (default) on project sparkjdk9: 
[ERROR] Exit code: 2
[ERROR] Command line was: /bin/sh -c '/Library/Java/JavaVirtualMachines/jdk-9.jdk/Contents/Home/bin/jdeps' '-M' '.../sparkjdk9/target/classes'

Looking further for similar flag in jdeps tool, I could see the error is justified since there is no such flag -M in its usage.

Q. What is the use of this attribute and how can it be used?

Naman
  • 27,789
  • 26
  • 218
  • 353

1 Answers1

4

See https://github.com/apache/maven-plugins/blob/trunk/maven-jdeps-plugin/src/main/java/org/apache/maven/plugin/jdeps/AbstractJDepsMojo.java#L322

The -M used to be the module parameter, but it seems like it has been renamed to -m/--module in the meantime.

Update : This should be resolved with 3.1.1 release of the Maven JDeps Plugin as followed by the tracker](See https://github.com/apache/maven-plugins/blob/trunk/maven-jdeps-plugin/src/main/java/org/apache/maven/plugin/jdeps/AbstractJDepsMojo.java#L322

The -M used to be the module parameter, but it seems like it has been renamed to -m/--module in the meantime.

Update : This should be resolved with 3.1.1 release of the Maven JDeps Plugin as followed by the tracker.

Naman
  • 27,789
  • 26
  • 218
  • 353
Robert Scholte
  • 11,889
  • 2
  • 35
  • 44
  • Not sure where to raise this as a bug to add to the tracker for the plugin to fix. Also, `-m / --module ` in tool I can see are used to specify the root module for analysis..would this also need a change in `Type` pf the attribute? (not aware of what was the initial construct used) – Naman Oct 13 '17 at 18:20
  • 2
    That would be issues.apache.org/jira/browse/MJDEPS – Robert Scholte Oct 13 '17 at 18:28