We have a global parent pom project that contains the configuration (checkstyle, licensing, etc) (everit-maven-main on Github, org.everit.config.main on Maven Central) of our maven based projects. We would like to add the baselining-maven-plugin with following configration to it:
<plugin>
<groupId>net.distilledcode.maven</groupId>
<artifactId>baselining-maven-plugin</artifactId>
<version>1.0.4</version>
<executions>
<execution>
<id>baseline</id>
<goals>
<goal>baseline</goal>
</goals>
<configuration>
<explain>true</explain>
</configuration>
</execution>
</executions>
</plugin>
The build of this parent pom project fails with a NullPointerException:
Caused by: java.lang.NullPointerException
at net.distilledcode.maven.baselining.BaselineMojo.isBundle(BaselineMojo.java:253)
at net.distilledcode.maven.baselining.BaselineMojo.execute(BaselineMojo.java:128)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:133)
The artifact.getFile() method returns null for pom packaging and that causes the NPE.
I haven tried to fix this issue (return false in the isBundle() method if the artifactFile == null) and send a pull request, but I don't understand something. Why the plugin continues its execution if the isBundle() method returns false?
if (isBundle(artifact.getFile())) {
getLog().debug("Execution skipped, artifact is not a jar file.");
return;
}
In my understanding thats the case where the execution should be skipped.
My fix is not working obviously because the artifact.getFile() is also used when the baseline() method invoked and that causes another NPE:
Caused by: java.lang.NullPointerException
at aQute.bnd.osgi.Jar.getName(Jar.java:80)
at aQute.bnd.osgi.Jar.<init>(Jar.java:70)
at net.distilledcode.maven.baselining.BaselineMojo.baseline(BaselineMojo.java:369)
at net.distilledcode.maven.baselining.BaselineMojo.execute(BaselineMojo.java:153)
Please help me to clarify this issue. Thanks!