Im creating a jenkins pipeline and I need to publish buildInfo in artifactory using artifactory plugin, this project has submodules with their own POM inside.
My pipeline is similar to this
pipeline {
agent any
stages {
stage('Checkout') {
steps {
git 'https://github.com/example/repo.git'
}
}
stage('Build and Publish') {
steps {
script {
def server = Artifactory.server('artifactory-server')
def rtMaven = Artifactory.newMavenBuild()
rtMaven.deployer releaseRepo: 'libs-release-local', snapshotRepo: 'libs-snapshot-local', server: server
rtMaven.resolver releaseRepo: 'libs-release', snapshotRepo: 'libs-snapshot', server: server
rtMaven.deployer.deployArtifacts = true
def buildInfo = rtMaven.run pom: 'pom.xml', goals: 'clean install'
// Publish build info to Artifactory
server.publishBuildInfo buildInfo
}
}
}
}
}
I keep getting this exception
Caused by: java.lang.NullPointerException
at org.jfrog.build.extractor.maven.BuildInfoRecorder.addDependenciesToCurrentModule(BuildInfoRecorder.java:619)
at org.jfrog.build.extractor.maven.BuildInfoRecorder.addModuleToBuild(BuildInfoRecorder.java:466)
at org.jfrog.build.extractor.maven.BuildInfoRecorder.finalizeModule(BuildInfoRecorder.java:389)
at org.jfrog.build.extractor.maven.BuildInfoRecorder.projectSucceeded(BuildInfoRecorder.java:208)
Any Idea how to avoid this exception or a way to overwrite the NPE in BuildInfoRecorder?
Im using artifactory plugin 3.18.3 and using Jenkins 2.397
I change the maven version to 3.5 and it worked correctly