我有几个不一致的在我的pom,所以我试图升级所有版本,java到11和所有插件到最新的。
现在我有严重的问题与maven-plugin-plugin:
[INFO] --- maven-plugin-plugin:3.6.4:descriptor (default-descriptor) @ latex-maven-plugin ---
[INFO] Using 'UTF-8' encoding to read mojo source files.
[INFO] java-javadoc mojo extractor found 0 mojo descriptor.
[INFO] bsh mojo extractor found 0 mojo descriptor.
[INFO] ant mojo extractor found 0 mojo descriptor.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 15.423 s
[INFO] Finished at: 2022-03-03T02:49:06+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-site-plugin:3.9.1:site (default-site) on project latex-maven-plugin: failed to get report for org.apache.maven.plugins:maven-jxr-plugin: Failed to execute goal org.apache.maven.plugins:maven-plugin-plugin:3.6.4:descriptor (default-descriptor) on project latex-maven-plugin: Execution default-descriptor of goal org.apache.maven.plugins:maven-plugin-plugin:3.6.4:descriptor failed.: NullPointerException -> [Help 1]
在https://github.com/Reissner/maven-latex-plugin中,我推送了最新的工作版本。
如果我从java8升级到java 11,在编译器插件中,但保留插件-插件版本与原始3.3我获得
[INFO] Applying mojo extractor for language: java-annotations
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9.367 s
[INFO] Finished at: 2022-03-04T22:25:03+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-plugin-plugin:3.3:descriptor (default-descriptor) on project latex-maven-plugin: Execution default-descriptor of goal org.apache.maven.plugins:maven-plugin-plugin:3.3:descriptor failed.: IllegalArgumentException -> [Help 1]
有趣的是,即使升级mockito会导致plugin-plugin出现问题。
升级插件插件也没有帮助。唯一改变的是抛出的异常类型。所以在maven-plugin-plugin 3.6.0中,我得到了一个空指针异常。
Caused by: java.lang.NullPointerException
at org.apache.maven.tools.plugin.extractor.annotations.JavaAnnotationsMojoDescriptorExtractor.extractFieldParameterTags (JavaAnnotationsMojoDescriptorExtractor.java:405)
at org.apache.maven.tools.plugin.extractor.annotations.JavaAnnotationsMojoDescriptorExtractor.populateDataFromJavadoc (JavaAnnotationsMojoDescriptorExtractor.java:286)```
As i want a newer version for the plugin I tried hard to find out what's going wrong.
Here is part of the stacktrace for 3.6.4:
导致原因:java.lang.NullPointerException at org.apache.maven.tools.plugin.extractor.annotations.JavaAnnotationsMojoDescriptorExtractor.extractFieldParameterTags(JavaAnnotationsMojoDescriptorExtractor. java:408)at org.apache.maven.tools.plugin.extractor.annotations.JavaAnnotationsMojoDescriptorExtractor.populateDataFromJavadoc(JavaAnnotationsMojoDescriptorExtractor. java:280)
Note that the exceptions now come at a different place.
I found the source I give below:
private Map<String, JavaField>extractFieldParameterTags(JavaClass javaClass, Map<String, JavaClass> javaClassesMap) {
try {
Map<String, JavaField> rawParams = new TreeMap<>();
// we have to add the parent fields first, so that they will be overwritten by the local fields if
// that actually happens...
JavaClass superClass = javaClass.getSuperJavaClass();
if (superClass != null) {
if (superClass.getFields().size() > 0) {
rawParams = extractFieldParameterTags( superClass, javaClassesMap );
}
// maybe sources comes from scan of sources artifact
superClass = javaClassesMap.get(superClass.getFullyQualifiedName());
if (superClass != null) {
rawParams = extractFieldParameterTags(superClass, javaClassesMap);
}
} else {
rawParams = new TreeMap<>();
}
for (JavaField field : javaClass.getFields()) {
rawParams.put(field.getName(), field); // <----- line 408
}
return rawParams;
} catch (NoClassDefFoundError e) {
getLogger().warn( "Failed extracting parameters from " + javaClass );
throw e;
}
}
I marked line 408 but cannot find a reason why this shall go wrong.
Help very much appreciated.
1条答案
按热度按时间ymdaylpp1#
过了很久,我找到了一个答案。愿读者自己决定这是否值得贴上“答案”的标签。无论如何,这是一个警告。
我去上课了
似乎与mojos无关,也在核心包中,这意味着,真正远离将软件变成maven插件的功能。
信不信由你,去掉这条线
解决了这个问题。我不知道
maven-plugin-plugin
执行的是哪种分析。