IDEA
例如,我们希望添加下面的编译参数到我们的一个 IntelliJ IDEA 项目中:
--add-exports java.base/jdk.internal.vm.annotation=ALL-UNNAMED
例如我们可以通过在项目的配置路径中进行添加,添加的模块和参数请参考上图。
Maven
如果使用 Maven 的话,那么需要在 maven-compiler-plugin 插件中添加编译参数。
下面是完整的插件内容添加片段:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<release>${java.version}</release>
<compilerArgs>
<arg>--add-exports</arg>
<arg>java.base/jdk.internal.vm.annotation=ALL-UNNAMED</arg>
</compilerArgs>
</configuration>
</plugin>
上图显示的是编译插件添加的情况。