-J-Xbootclasspath/p:不是由maven编译器插件传递的,我如何解决它?
系统环境: jdk 1.8.0_265,windows 10。
maven文件:我从CheckerFramework示例pom.xml复制它。
<compilerArgs>
<!-- using github.com/google/error-prone-javac is required when running on JDK 8 -->
<arg>-J-Xbootclasspath/p:${errorProneJavac}</arg>
<!-- -Awarns treats Checker Framework errors as warnings -->
<!-- <arg>-Awarns</arg> -->
<!--
For the Subtyping Checker, annotations defined in module 'your-qual-artifact':
<arg>-Aquals=myPackage.qual.MyFenum,myPackage.qual.MyCustomType</arg>
-->
<arg>-Alint</arg>
<!-- If using JDK 11 remove the two arguments above and uncomment the one below. -->
<!-- <arg>-J- -add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED</arg> -->
<!-- -Awarns turns type-checking errors into warnings. -->
<!-- <arg>-Awarns</arg> -->
</compilerArgs>当我第一次通过mvn干净编译运行它时,它与
未能在项目org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (默认编译)上执行目标MavenExample:编译失败
因此,我运行mvn干净编译-X,然后发现命令行选项中没有包括-javac.jar/p:/path/to/javac.jar。
然后我在其中包含“- javac /p”,并编译它,它就成功了。但是我需要在maven中使用,所以我问这个问题。
这是打印失败的命令行选项。
调试 -d D:\workproject\TestCheck\target\classes 美国皇家银行(D:\workproject\TestCheck\target\classes;C:\Users\.m2\repository\org\checkerframework\checker-qual\3.6.1\checker-qual-3.6.1.jar;C:\Users\.m2\repository\com\google\errorprone\javac\9+181-r4173-1\javac-9+181-r4173-1.jar;C:\Users\张云.m2\repository\org\apache\commons\commons-lang3\3.1\commons-lang3-3.1.jar;)C:\User\张云张云 D:\workproject\TestCheck\src\main\java;D:\workproject\TestCheck\target\generated-sources\annotations;D:\workproject\TestCheck\src\main\java\Main.java D:\workproject\TestCheck\target\generated-sources\annotations -sourcepath -s -processor org.checkerframework.checker.nullness.NullnessChecker .m2\repository\org\checkerframework\checker\3.6.1\checker-3.6.1.jar;C:\ -processorpath \张云-g -verbose -target 1.8 -source 1.8 -encoding UTF-8 -Alint
这是完整的日志文件日志
和项目文件
发布于 2020-09-22 05:31:05
谢谢你提供这个项目,这是非常有帮助的。
当我运行mvn -e -B clean install --debug时,Checker正常工作:它在文件Main.java的第10行发出了一个关于return null的错误
[ERROR] /home/mernst/tmp/TestCheck/src/main/java/Main.java:[10,15] error: [return.type.incompatible] incompatible types in return.
type of expression: null
method return type: @Initialized @NonNull String完整的日志位于https://pastebin.com/4kHe4WMz。
在我的输出和您提供的日志之间有一些可疑的差别。
在您提供的项目上运行时,我的输出包含:
<compilerArgs>
<arg>-J-Xbootclasspath/p:${com.google.errorprone:javac:jar}</arg>
<arg>-Alint</arg>
</compilerArgs>相比之下,您粘贴的日志包含:
<compilerArgs>
<arg>-Alint</arg>
</compilerArgs>
<compilerArgument>-J-Xbootclasspath/p:/a/b</compilerArgument>我对这种差异没有任何解释。例如,我不知道输出中的/a/b路径来自何处,因为在您提供的项目中没有出现这个路径。我怀疑您使用与您提供的项目不同的pom.xml从不同的项目粘贴日志。
https://stackoverflow.com/questions/63987776
复制相似问题