我找到了 module
maven-jdeps-plugin
官方文档中的属性指出
Show module containing the package
- Type: boolean
- Since: JDK 1.9.0
- Required: No
- User Property: jdeps.module
- Default: false
尝试将其与当前最小的 pom.xml
一起使用,如下所示:-
<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>
我的项目(名为sparkjdk9)在执行时的构建
mvn clean install
这些日志中的结果:-
[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'
在 jdeps
中进一步寻找类似标志工具,我可以看到错误是合理的,因为在其用法中没有这样的标志 -M
。
问。这个属性有什么用,如何使用?
最佳答案
-M
原来是模块参数,现在好像改名为-m
/--module
同时。
更新:这应该通过跟踪器之后的 Maven JDeps 插件 3.1.1 版本解决](参见 https://github.com/apache/maven-plugins/blob/trunk/maven-jdeps-plugin/src/main/java/org/apache/maven/plugin/jdeps/AbstractJDepsMojo.java#L322
-M
原来是模块参数,现在好像改名为-m
/--module
同时。
更新:这应该通过 Maven JDeps 插件的 3.1.1 版本解决,如下所示 by the tracker.
关于java - 错误 : unknown option: -M while using module option of maven-jdeps-plugin,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46727928/