Error: unknown option: -M when using the maven-jdeps-plugin module option

I found the moduleattribute in the official documentation maven-jdeps-plugin, which says that

Show module containing package

  • Type: boolean
  • Starting from: JDK 1.9.0
  • Mandatory parameter: No
  • Custom Property: jdeps.module
  • Default: false

Trying to use it with the current minimum pom.xmlas 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>

Building my project (called sparkjdk9) on execution

mvn clean install

results in these magazines: -

[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 back at a similar flag in jdeps, I see that the error is justified, since there is no such flag -Min its use.

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

+4

Source: https://habr.com/ru/post/1687428/


All Articles