You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

限制Java模块时出现编译错误,请求技术帮助

解决Tycho编译时"无法识别选项:java.datatransfer"错误

你的编译错误源于配置中的两处问题:

  • 模块列表里java.smartcardio和java.sql连写在一起,缺失分隔逗号,导致后续模块参数被编译器误判为独立选项
  • --limit-modules参数与模块列表未正确拆分,Tycho编译器插件要求每个命令行参数单独定义

修正后的配置代码如下:

<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>
      <arg>--limit-modules</arg>
      <arg>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.smartcardio,java.sql,java.sql.rowset,java.transaction.xa,java.xml.crypto,jdk.accessibility,jdk.attach,jdk.charsets,jdk.compiler,jdk.crypto.cryptoki,jdk.crypto.ec</arg>
    </compilerArgs>
    <useProjectSettings>true</useProjectSettings>
  </configuration>
</plugin>

修正说明:

  1. 在java.smartcardio后添加逗号,与java.sql正确分隔,确保所有模块名称被编译器正确识别
  2. 将--limit-modules作为单独的<arg>元素,模块列表作为另一<arg>元素,符合Tycho对编译器参数的传递要求

内容的提问来源于stack exchange,提问作者Asawari

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.11 02:15:36