NPE with bnd-baseline-maven-plugin

113 views
Skip to first unread message

Simon Chemouil

unread,
Apr 28, 2017, 12:15:40 PM4/28/17
to bndtools-users
Hi,

I'm trying to get the bnd-baseline-maven-plugin plugin working, but I get the following NPE: An error occurred while calculating the baseline: NullPointerException 
A quick glance at the stacktrace shows the NPE happens in a Maven component, Aether, in class DefaultVersionResolver, where "VersionRequest" seems to be null (that would imply a problem with the invocation by bnd-baseline-maven-plugin ?).

I have an existing release in Maven Central I'd like to use as my baseline. I have a log in Maven debug mode showing the right version (1.0.0) is found. Setting it explicitly with the <base/> coordinates does not fix the issue:

<plugin>
<groupId>biz.aQute.bnd</groupId>
<artifactId>bnd-baseline-maven-plugin</artifactId>
<configuration>
<base>
<groupId>${project.groupId}</groupId>
<artifactId>${project.artifactId}</artifactId>
<version>1.0.0</version>
</base>
<continueOnError>false</continueOnError>
<fullReport>true</fullReport>
</configuration>
</plugin>


Any help is much appreciated!

Below the error I get:

[DEBUG] Baselining against Base [groupId=io.primeval, artifactId=primeval-commons, version=null, classifier=, extension=jar], fail on missing: true
[INFO] Automatically determining the baseline version for io.primeval:primeval-commons:jar:1.1.0-SNAPSHOT using repositories [null, nexus (http://172.17.10.31:8081/nexus/content/groups/public/, releases+snapshots)]
[DEBUG] Skipped remote update check for io.primeval:primeval-commons/maven-metadata.xml, locally cached metadata up-to-date.
[DEBUG] Found versions [1.0.0-SNAPSHOT, 1.0.0]
[INFO] The baseline version was found to be 1.0.0
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.385 s
[INFO] Finished at: 2017-04-28T17:58:06+02:00
[INFO] Final Memory: 16M/205M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal biz.aQute.bnd:bnd-baseline-maven-plugin:3.3.0:baseline (baseline) on project primeval-commons: An error occurred while calculating the baseline: NullPointerException -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal biz.aQute.bnd:bnd-baseline-maven-plugin:3.3.0:baseline (baseline) on project primeval-commons: An error occurred while calculating the baseline
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:120)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:347)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:154)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:582)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: An error occurred while calculating the baseline
at aQute.bnd.maven.baseline.plugin.BaselineMojo.execute(BaselineMojo.java:123)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 19 more
Caused by: java.lang.NullPointerException
at org.apache.maven.repository.internal.DefaultVersionResolver$Key.<init>(DefaultVersionResolver.java:559)
at org.apache.maven.repository.internal.DefaultVersionResolver.resolveVersion(DefaultVersionResolver.java:183)
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:318)
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:262)
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:239)
at org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveArtifact(DefaultRepositorySystem.java:295)
at aQute.bnd.maven.baseline.plugin.BaselineMojo.locateBaseJar(BaselineMojo.java:193)
at aQute.bnd.maven.baseline.plugin.BaselineMojo.execute(BaselineMojo.java:89)
... 21 more


BJ Hargrave

unread,
Apr 28, 2017, 1:20:48 PM4/28/17
to bndtool...@googlegroups.com
You do not mention what version of the bnd-baseline-maven-plugin you are using. That have been significant changes in the 3.4.0 snapshot builds. Perhaps you can try the latest snapshot?

--
You received this message because you are subscribed to the Google Groups "bndtools-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bndtools-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
BJ

Simon Chemouil

unread,
Apr 28, 2017, 7:03:08 PM4/28/17
to bndtools-users
I am using 3.3.0 for both bnd-maven-plugin & bnd-baseline-maven-plugin. I'll give 3.4.0-SNAPSHOT a try.

Simon Chemouil

unread,
May 12, 2017, 4:09:01 AM5/12/17
to bndtools-users
I took some time to try with 3.4.0-SNAPSHOT and it's no better. Exactly same issue.

I'm not doing anything fancy: my baseline artifact is found on Central.

Maybe someone who uses it successfully on a Maven project can point me to the right direction? In the mean time I'm going to debug it and see if I can fix the bug.

Simon

Simon Chemouil

unread,
May 12, 2017, 4:33:17 AM5/12/17
to bndtools-users
Le vendredi 12 mai 2017 10:09:01 UTC+2, Simon Chemouil a écrit :
Maybe someone who uses it successfully on a Maven project can point me to the right direction? In the mean time I'm going to debug it and see if I can fix the bug.

OK, I found and fixed the issue.
My projects don't use <distributionManagement/> (because I find it evil) and bnd-baseline-maven-plugin tries to use it by default, unless a property bnd.baseline.include.distribution.management is explicitly set to false using:

<properties>
<bnd.baseline.include.distribution.management>false</bnd.baseline.include.distribution.management>
</properties>

I believe there is still a bug in the plugin, BaselineMojo's List<RemoteRepository> getRepositories(Artifact) method which should check if the project's distributionManagement is null before adding it to the repository list. I'll provide a fix.

Simon
Reply all
Reply to author
Forward
0 new messages