'maven-plugin-plugin:3.6.4:descriptor failed.: NullPointerException
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.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
