[HAP-665] NullPointerException when trying to build (publishing to artifactory not enabled) Created: 16/Nov/15  Updated: 06/Dec/15  Resolved: 06/Dec/15

Status: Resolved
Project: Jenkins Artifactory Plug-in
Component/s: None
Affects Version/s: 2.4.0, 2.4.1, 2.4.4
Fix Version/s: 2.4.5

Type: Bug Priority: Normal
Reporter: Tomáš Rohrbacher Assignee: Aviad Shikloshi (Inactive)
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Duplicate
is duplicated by HAP-667 Trying to write Artifactory version t... Open
is duplicated by HAP-673 NullPointerException when a job has n... Resolved

 Description   

A simple project that is only set to retrieve artifacts from artifactory (not publish them) failed to build.

Builds that have all artifactory features turned off are fine as are the ones that publish to Artifactory using the "Deploy artifacts to artifactory" post build action. Removing the post build action while still using some of the artifactory plugin functionality causes the following error.

The workaround is not to use Artifactory plugin.

ERROR: Processing failed due to a bug in the code. Please report this to jenkinsci-users@googlegroups.com
java.lang.RuntimeException: java.lang.NullPointerException
at org.jfrog.hudson.maven3.extractor.MavenExtractorEnvironment.buildEnvVars(MavenExtractorEnvironment.java:136)
at hudson.model.AbstractBuild.getEnvironment(AbstractBuild.java:941)
at hudson.maven.AbstractMavenBuild.getEnvironment(AbstractMavenBuild.java:56)
at hudson.maven.MavenModuleSetBuild.getEnvironment(MavenModuleSetBuild.java:166)
at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.doRun(MavenModuleSetBuild.java:622)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:536)
at hudson.model.Run.execute(Run.java:1738)
at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:531)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:381)
Caused by: java.lang.NullPointerException
at org.jfrog.hudson.util.ExtractorUtils.addBuilderInfoArguments(ExtractorUtils.java:157)
at org.jfrog.hudson.maven3.extractor.MavenExtractorEnvironment.buildEnvVars(MavenExtractorEnvironment.java:132)
... 9 more
project=hudson.maven.MavenModuleSet@1bc3d9f[JOBS_STABLE/INSTALL Elvoris _ROOT_ (master)]
project.getModules()=[hudson.maven.MavenModule@3d7897[JOBS_STABLE/INSTALL Elvoris _ROOT_ (master)/cz.elvoris:elvoris-root-parent][JOBS_STABLE/INSTALL Elvoris _ROOT_ (master)/cz.elvoris:elvoris-root-parent][relativePath:parent]]
project.getRootModule()=hudson.maven.MavenModule@3d7897[JOBS_STABLE/INSTALL Elvoris _ROOT_ (master)/cz.elvoris:elvoris-root-parent][JOBS_STABLE/INSTALL Elvoris _ROOT_ (master)/cz.elvoris:elvoris-root-parent][relativePath:parent]
FATAL: java.lang.NullPointerException
java.lang.RuntimeException: java.lang.NullPointerException
at org.jfrog.hudson.maven3.extractor.MavenExtractorEnvironment.buildEnvVars(MavenExtractorEnvironment.java:136)
at hudson.model.AbstractBuild.getEnvironment(AbstractBuild.java:941)
at hudson.maven.AbstractMavenBuild.getEnvironment(AbstractMavenBuild.java:56)
at hudson.maven.MavenModuleSetBuild.getEnvironment(MavenModuleSetBuild.java:166)
at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.doRun(MavenModuleSetBuild.java:622)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:536)
at hudson.model.Run.execute(Run.java:1738)
at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:531)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:381)
Caused by: java.lang.NullPointerException
at org.jfrog.hudson.util.ExtractorUtils.addBuilderInfoArguments(ExtractorUtils.java:157)
at org.jfrog.hudson.maven3.extractor.MavenExtractorEnvironment.buildEnvVars(MavenExtractorEnvironment.java:132)
... 9 more



 Comments   
Comment by Aviad Shikloshi (Inactive) [ 19/Nov/15 ]

Thanks for reporting this issue.

I'm attaching link to a snapshot version with the fix (on top of plugin version 2.4.4) so you can try to run this one.
Please note that this is a snapshot version and it is not fully tested. The fix will be a part of the next Jenkins Artifactory plugin release.

Download link: https://oss.jfrog.org/artifactory/oss-snapshot-local/org/jenkins-ci/plugins/artifactory/2.4.x-SNAPSHOT/artifactory-2.4.x-20151119.104300-1.hpi

We will appreciate your feedback.

Comment by Tomáš Rohrbacher [ 19/Nov/15 ]

I have verified that the fix fixes the issue.
Thank you.

However, we have moved towards more neutral repository declaration inside the maven settings.xml (or gradle.properties) files.
It works the same way as "Resolve artifacts from Artifactory" and allows for greater flexibility.

Generated at Wed Oct 23 00:52:09 UTC 2019 using JIRA 7.6.16#76018-sha1:9ed376192612a49536ac834c64177a0fed6290f5.