为什么我在限制Java模块时出错



编译时出现致命错误:无法识别的选项:java。datatransfer→[帮助1](错误)要查看错误的完整堆栈跟踪,请使用-e开关重新运行Maven。使用-X开关重新运行Maven以启用完整的调试日志记录。(错误)[ERROR]有关错误和可能解决方案的更多信息,请阅读以下文章:[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

我得到上面的错误,而限制java模块。有人能帮我弄明白吗。下面是我限制模块的部分。

<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-compiler-plugin</artifactId>
<version>${tycho-version}</version>
<configuration>
<compilerArgument>--warn:none</compilerArgument>
<compilerArgument>--err:none</compilerArgument>
<compilerArgument>-warn:+discouraged,forbidden</compilerArgument>
<compilerArgs>--limit-modules,java.base,java.compiler,java.datatransfer,java.desktop,java.instrument,java.logging,java.management,java.management.rmi,java.naming,java.net.http,java.prefs,java.rmi,java.scripting,java.se,java.security.jgss,java.security.sasl,java.smartcardiojava.sql,java.sql.rowset,java.transaction.xa,java.xml.crypto,jdk.accessibility,jdk.attach,jdk.charsets,jdk.compiler,jdk.crypto.cryptoki,jdk.crypto.ec</compilerArgs>                   
<useProjectSettings>true</useProjectSettings>
</configuration>
</plugin>


I'm not able to limit the module.

--limit-modules的列表是一个单独的参数。

混合compilerArgumentcompilerArgs不能正常工作,compilerArgs覆盖被忽略的compilerArgument条目(您可以告诉这一点,因为--warn:none--err:none实际上无效)。

所以使用:

<compilerArgs>
<arg>-warn:none</arg>
<arg>-err:none</arg>
<arg>-warn:+discouraged,forbidden</arg>
<arg>--limit-modules</arg>
<arg>java.base,java.compiler ... rest of modules ...</arg>
</compilerArgs>

最新更新