SMP*_*MPH 2 intellij-idea maven-3
(2020.3.4当我尝试构建/运行项目时,我的 java 项目中的IDE 中出现以下错误。由于此问题,我无法通过 IDE 构建/运行应用程序。
java: warnings found and -Werror specified
Run Code Online (Sandbox Code Playgroud)
我在 POM 文件中找到了下面的行,并尝试对此进行评论。但同样的错误。
<configuration>
<forceJavacCompilerUse>true</forceJavacCompilerUse>
<compilerArgs>
<!-- <arg>-Werror</arg>-->
<arg>-verbose</arg>
</compilerArgs>
<source>11</source>
<target>11</target> <!--or <release>10</release>-->
</configuration>
Run Code Online (Sandbox Code Playgroud)
这是任何设置特定错误吗?
我遇到了同样的问题,我通过Werror从 Intellij 中删除标志来解决该问题:
file > settings > Build, Execution Deployment > Java Compiler
Run Code Online (Sandbox Code Playgroud)
在底部,您可以Override compiler parameter从那里找到它,您可以通过单击-按钮删除该选项
另外,请验证是否将此标志传递给maven-compiler-plugin,如果不需要,请将其删除。
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<compilerArgs>
<arg>-Werror</arg>
<arg>-Xlint:all</arg>
<arg>-Xlint:-deprecation</arg>
<arg>-Xlint:-options</arg>
<arg>-Xlint:-processing</arg>
<arg>-Xlint:-serial</arg>
</compilerArgs>
<showWarnings>true</showWarnings>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)