maven-plugin-plugin:3.6.4:描述符失败。:NullPointerException
我的 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-插件 我推送了最新的工作版本。
如果我在编译器插件中一致地从 java 8 升级到 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 会导致插件-插件出现问题。
另外升级插件插件也没有帮助。 唯一改变的是抛出异常的类型。 所以使用 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 在 org.apache.maven.tools.plugin.extractor.annotations.JavaAnnotationsMojoDescriptorExtractor.extractFieldParameterTags (JavaAnnotationsMojoDescriptorExtractor.java:408) 在 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.
I had several inconsistencies in my pom so i tried to upgrade all versions, java to 11
and all plugins to the newest.
Now I have severe problem with 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]
In https://github.com/Reissner/maven-latex-plugin
i pushed the latest working versions.
If I upgrade from java 8 to java 11 consistently, in compiler plugin, but leave the plugin-plugin version with the original 3.3 I obtain
[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]
Interesting enough, even if upgrading mockito causes problems with the plugin-plugin.
Also upgrading the plugin-plugin does not help.
The only thing changing is the kind of exception thrown.
So with maven-plugin-plugin 3.6.0
I obtain a nullpointer exception.
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:
Caused by: 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
经过很很长一段时间,我找到了类似于我的问题的答案。
希望读者自己决定这是否值得贴上“答案”的标签。
无论如何,这都是一个警告。
我有一个类
貌似与mojos无关,也在核心包中,
意味着,将软件变成 Maven 插件的功能真的很远。
不管你信不信,去掉这条线
就可以解决问题。
我无法弄清楚
maven-plugin-plugin
执行什么样的分析。After very long time, I found something like an answer to my question.
May the reader decide him/herself whether this is worth the label 'answer'.
In any case it is a warning.
I had a class
Seemingly has nothing to do with mojos and is also in the core package,
means, really far away from functionality turning the software into a maven plugin.
Believe or not, removing the line
resolves the problem.
I cannot figure out, what kind of analysis
maven-plugin-plugin
performs.