Execution default-cli of goal org.apache.maven.plugins:maven-release-plugin:2.2.2:prepare failed. NullPointerException

10,997

For me its resolved scm tag and release plugin moved to child pom. It means deleted scm tag and release plugin details from the parent pom

Share:
10,997
H L
Author by

H L

Updated on June 04, 2022

Comments

  • H L
    H L about 2 years

    Here is the Context: I have successfully built the project with the following commands (called from maven-release-plugin in Jenkins)

    mvn clean -Pall
    mvn generate-sources -Pgs 
    mvn -PjenkinsBuild install package assembly:single -Pall -Denvironment=dev
    

    Now, when I try to release the project with maven-release-plugin in Jenkins, with the following commands. It failed.(error log and pom at the end)

    mvn -X release:prepare release:perform
    

    Tried some unsuccessful solutions: 1.Modified the config of maven-release-plugin, suspecting developers and Jenkins are using different vesion of SVN.

    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-release-plugin</artifactId>
      <version>2.4.1</version>
      <configuration>
        <branchBase>${svn.base}/branches/releases</branchBase>
        <tagBase>${svn.base}/tags/releases/</tagBase>
        <autoVersionSubmodules>true</autoVersionSubmodules>
        <suppressCommitBeforeBranch>true</suppressCommitBeforeBranch>
        <remoteTagging>false</remoteTagging>
        <updateBranchVersions>true</updateBranchVersions>
        <updateWorkingCopyVersions>false</updateWorkingCopyVersions>
        <providerImplementations>
              <svn>javasvn</svn>
        </providerImplementations>
      </configuration>
      <dependencies>
        <dependency>
          <groupId>com.google.code.maven-scm-provider-svnjava</groupId>
          <artifactId>maven-scm-provider-svnjava</artifactId>
          <version>2.0.6</version>
          <scope>compile</scope>
        </dependency>
      </dependencies>
    </plugin>
    
    1. Tried to added the groupID explicitly, according to one of the suggestions

      tc.strongview strongview-soap-client jar Strongview SOAP Client

    And a section of the POM

    http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0

    <groupId>tc.strongview</groupId>
    <artifactId>strongview-etl-core</artifactId>
    <version>0.2.0-SNAPSHOT</version>
    <packaging>pom</packaging>
    
        <scm>
        <connection>
            scm:svn:https://xxxxxxxxx/svn/strongview-etl-core/branches/releases/strongview-etl-core-0.2
        </connection>
        <developerConnection>
            scm:svn:https://xxxxxxxxx/svn/strongview-etl-core/branches/releases/strongview-etl-core-0.2
        </developerConnection>
        <url>https://xxxxxxxxx/svn/strongview-etl-core/branches/releases/strongview-etl-core-0.2
        </url>
        </scm>
    
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.2.3.RELEASE</version>
        <relativePath /> <!-- lookup parent from repository -->
    </parent>
    
    <modules>
        <module>strongview-etl-common</module>
        <module>strongview-soap-client</module>
        <module>strongview-etl-definitions</module>
    </modules>
    
    <distributionManagement>
    ...................................................
    ...................................................
    ...................................................
    </distributionManagement>
    
    <repositories>
    ...................................................
    ...................................................
    ...................................................
    </repositories>
    
    <profiles>
    ...................................................
    ...................................................
    ...................................................
    </profile>
    
    </profiles>
    
    <properties>
    ...................................................
    ...................................................
    ...................................................
    </properties>
    
    <build>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
        </resources>
        <extensions>
            <extension>
                <groupId>org.apache.maven.wagon</groupId>
                <artifactId>wagon-ssh</artifactId>
                <version>2.9</version>
            </extension>
            <extension>
                <groupId>com.github.shyiko.servers-maven-extension</groupId>
                <artifactId>servers-maven-extension</artifactId>
                <version>1.3.0</version>
            </extension>
        </extensions>
    
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>
                <version>2.5.2</version>
                <configuration>
                    <branchBase>${svn.base}/branches/releases</branchBase>
                    <tagBase>${svn.base}/tags/releases/</tagBase>
                    <autoVersionSubmodules>true</autoVersionSubmodules>
                    <suppressCommitBeforeBranch>true</suppressCommitBeforeBranch>
                    <remoteTagging>false</remoteTagging>
                    <updateBranchVersions>true</updateBranchVersions>
                    <updateWorkingCopyVersions>false</updateWorkingCopyVersions>
                </configuration>
            </plugin>
    
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
                <configuration>
                    <descriptors>
                        <descriptor>${project.parent.basedir}/assembly/distribution.xml</descriptor>
                    </descriptors>
                    <appendAssemblyId>false</appendAssemblyId>
                    <finalName>${distribution.name}</finalName>
                    <includeProjectBuildFilters>true</includeProjectBuildFilters>
                    <ignoreMissingDescriptor>true</ignoreMissingDescriptor>
                </configuration>
            </plugin>
    
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>wagon-maven-plugin</artifactId>
                <version>1.0</version>
                <configuration>
                    <serverId>${deployment.server}</serverId>
                    <fromDir>${project.build.directory}</fromDir>
                    <includes>${distribution.name}.zip</includes>
                    <url>scp://${etl.server.url}:${etl.server.distribution.dir}</url>
                </configuration>
            </plugin>
    
        </plugins>
    </build>
    
    <dependencyManagement>
    ...................................................
    ...................................................
    ...................................................
    </dependencies>
    

    New error log released with Maven 3.3.3 and maven-release-plugin 2.5.2 and simple "release:prepare release:perform"

    Started by user 
    [EnvInject] - Loading node environment variables.
    Building on master in workspace /data/jenkins/workspace/strongview-etl-core-Release4 - Latest Maven
    Cleaning up /data/jenkins/workspace/strongview-etl-core-Release4 - Latest Maven/.
    Deleting /data/jenkins/workspace/strongview-etl-core-Release4 - Latest Maven/pom.xml.releaseBackup
    Deleting /data/jenkins/workspace/strongview-etl-core-Release4 - Latest Maven/release.properties
    Deleting /data/jenkins/workspace/strongview-etl-core-Release4 - Latest Maven/pom.xml
    Deleting /data/jenkins/workspace/strongview-etl-core-Release4 - Latest Maven/strongview-etl-common/pom.xml.releaseBackup
    Deleting /data/jenkins/workspace/strongview-etl-core-Release4 - Latest Maven/strongview-soap-client/pom.xml.releaseBackup
    Deleting /data/jenkins/workspace/strongview-etl-core-Release4 - Latest Maven/strongview-etl-definitions/pom.xml.releaseBackup
    Updating https://xxxxxxxxx/svn/strongview-etl-core/branches/releases/strongview-etl-core-0.2 at revision '2015-08-04T15:33:30.474 -0400'
    At revision 80
    no change for https://xxxxxxxxx/svn/strongview-etl-core/branches/releases/strongview-etl-core-0.2 since the previous build
    Parsing POMs
    [strongview-etl-core-Release4 - Latest Maven] $ /opt/jdk1.8.0_45/bin/java -Xmx2048m -XX:MaxPermSize=512m -cp /data/jenkins/plugins/maven-plugin/WEB-INF/lib/maven31-agent-1.4.jar:/data/jenkins/tools/hudson.tasks.Maven_MavenInstallation/3.3.3/boot/plexus-classworlds-2.5.2.jar:/data/jenkins/tools/hudson.tasks.Maven_MavenInstallation/3.3.3/conf/logging jenkins.maven3.agent.Maven31Main /data/jenkins/tools/hudson.tasks.Maven_MavenInstallation/3.3.3 /var/cache/jenkins/war/WEB-INF/lib/remoting-2.36.jar /data/jenkins/plugins/maven-plugin/WEB-INF/lib/maven31-interceptor-1.4.jar /data/jenkins/plugins/maven-plugin/WEB-INF/lib/maven3-interceptor-commons-1.4.jar 35483
    Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=512m; support was removed in 8.0
    <===[JENKINS REMOTING CAPACITY]===>channel started
    log4j:WARN No appenders could be found for logger (org.apache.commons.beanutils.converters.BooleanConverter).
    log4j:WARN Please initialize the log4j system properly.
    Executing Maven:  -B -f /data/jenkins/workspace/strongview-etl-core-Release4 - Latest Maven/pom.xml -DdevelopmentVersion=0.2.1-SNAPSHOT -DreleaseVersion=0.2.0 -X -Dresume=false release:prepare release:perform
    Apache Maven 3.3.3 (7994120775791599e205a5524ec3e0dfe41d4a06; 2015-04-22T07:57:37-04:00)
    Maven home: /data/jenkins/tools/hudson.tasks.Maven_MavenInstallation/3.3.3
    Java version: 1.8.0_45, vendor: Oracle Corporation
    Java home: /opt/jdk1.8.0_45/jre
    Default locale: en_US, platform encoding: UTF-8
    OS name: "linux", version: "2.6.32-279.14.1.el6.x86_64", arch: "amd64", family: "unix"
    [INFO] Error stacktraces are turned on.
    [DEBUG] Reading global settings from /data/jenkins/tools/hudson.tasks.Maven_MavenInstallation/3.3.3/conf/settings.xml
    [DEBUG] Reading user settings from /home/jenkins/.m2/settings.xml
    [INFO] Scanning for projects...
    [INFO] ------------------------------------------------------------------------
    [INFO] Reactor Build Order:
    [INFO] 
    [INFO] strongview-etl-core
    [INFO] Strongview SOAP Client
    [INFO] strongview-etl-common
    [INFO] strongview-etl-definitions
    [INFO]                                                                         
    [INFO] ------------------------------------------------------------------------
    [INFO] Building strongview-etl-core 0.2.0-SNAPSHOT
    [INFO] ------------------------------------------------------------------------
    [INFO] 
    [INFO] --- maven-release-plugin:2.5.2:prepare (default-cli) @ strongview-etl-core ---
    [INFO] Verifying that there are no local modifications...
    [INFO]   ignoring changes on: **/pom.xml.releaseBackup, **/pom.xml.next, **/pom.xml.tag, **/pom.xml.branch, **/release.properties, **/pom.xml.backup
    [INFO] Executing: /bin/sh -c cd "/data/jenkins/workspace/strongview-etl-core-Release4 - Latest Maven" && svn --non-interactive status
    [INFO] Working directory: /data/jenkins/workspace/strongview-etl-core-Release4 - Latest Maven
    [DEBUG] ?       release.properties
    [DEBUG] Ignoring changed file: release.properties
    [INFO] Checking dependencies and plugins for snapshots ...
    [INFO] Transforming 'strongview-etl-core'...
    [INFO]   Ignoring artifact version update for expression ${project.version}
    [INFO]   Ignoring artifact version update for expression ${project.version}
    [INFO] Transforming 'Strongview SOAP Client'...
    [INFO] ------------------------------------------------------------------------
    [INFO] Reactor Summary:
    [INFO] 
    [INFO] strongview-etl-core ................................ FAILURE [  2.944 s]
    [INFO] Strongview SOAP Client ............................. SKIPPED
    [INFO] strongview-etl-common .............................. SKIPPED
    [INFO] strongview-etl-definitions ......................... SKIPPED
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD FAILURE
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 5.724 s
    [INFO] Finished at: 2015-08-04T15:33:41-04:00
    [INFO] Final Memory: 20M/139M
    [INFO] ------------------------------------------------------------------------
    [ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.5.2:prepare (default-cli) on project strongview-etl-core: Execution default-cli of goal org.apache.maven.plugins:maven-release-plugin:2.5.2:prepare failed. NullPointerException -> [Help 1]
    org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.5.2:prepare (default-cli) on project strongview-etl-core: Execution default-cli of goal org.apache.maven.plugins:maven-release-plugin:2.5.2:prepare failed.
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:224)
        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:128)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
        at org.jvnet.hudson.maven3.launcher.Maven31Launcher.main(Maven31Launcher.java:132)
        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:497)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:330)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:238)
        at jenkins.maven3.agent.Maven31Main.launch(Maven31Main.java:181)
        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:497)
        at hudson.maven.Maven3Builder.call(Maven3Builder.java:134)
        at hudson.maven.Maven3Builder.call(Maven3Builder.java:69)
        at hudson.remoting.UserRequest.perform(UserRequest.java:118)
        at hudson.remoting.UserRequest.perform(UserRequest.java:48)
        at hudson.remoting.Request$2.run(Request.java:328)
        at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
    Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default-cli of goal org.apache.maven.plugins:maven-release-plugin:2.5.2:prepare failed.
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:145)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
        ... 31 more
    Caused by: java.lang.NullPointerException
        at org.apache.maven.shared.release.phase.AbstractRewritePomsPhase.translateUrlPath(AbstractRewritePomsPhase.java:847)
        at org.apache.maven.shared.release.phase.RewritePomsForReleasePhase.translateScm(RewritePomsForReleasePhase.java:202)
        at org.apache.maven.shared.release.phase.RewritePomsForReleasePhase.transformScm(RewritePomsForReleasePhase.java:64)
        at org.apache.maven.shared.release.phase.AbstractRewritePomsPhase.transformDocument(AbstractRewritePomsPhase.java:330)
        at org.apache.maven.shared.release.phase.AbstractRewritePomsPhase.transformProject(AbstractRewritePomsPhase.java:231)
        at org.apache.maven.shared.release.phase.AbstractRewritePomsPhase.transform(AbstractRewritePomsPhase.java:131)
        at org.apache.maven.shared.release.phase.AbstractRewritePomsPhase.execute(AbstractRewritePomsPhase.java:116)
        at org.apache.maven.shared.release.DefaultReleaseManager.prepare(DefaultReleaseManager.java:234)
        at org.apache.maven.shared.release.DefaultReleaseManager.prepare(DefaultReleaseManager.java:169)
        at org.apache.maven.shared.release.DefaultReleaseManager.prepare(DefaultReleaseManager.java:146)
        at org.apache.maven.shared.release.DefaultReleaseManager.prepare(DefaultReleaseManager.java:107)
        at org.apache.maven.plugins.release.PrepareReleaseMojo.prepareRelease(PrepareReleaseMojo.java:286)
        at org.apache.maven.plugins.release.PrepareReleaseMojo.execute(PrepareReleaseMojo.java:240)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
        ... 32 more
    [ERROR] 
    [ERROR] Re-run Maven using the -X switch to enable full debug logging.
    [ERROR] 
    [ERROR] For more information about the errors and possible solutions, please read the following articles:
    [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException
    [JENKINS] Archiving /data/jenkins/workspace/strongview-etl-core-Release4 - Latest Maven/strongview-etl-definitions/pom.xml to tc.strongview/strongview-etl-definitions/0.2.0-SNAPSHOT/strongview-etl-definitions-0.2.0-SNAPSHOT.pom
    [JENKINS] Archiving /data/jenkins/workspace/strongview-etl-core-Release4 - Latest Maven/strongview-soap-client/pom.xml to tc.strongview/strongview-soap-client/0.2.0-SNAPSHOT/strongview-soap-client-0.2.0-SNAPSHOT.pom
    [JENKINS] Archiving /data/jenkins/workspace/strongview-etl-core-Release4 - Latest Maven/strongview-etl-common/pom.xml to tc.strongview/strongview-etl-common/0.2.0-SNAPSHOT/strongview-etl-common-0.2.0-SNAPSHOT.pom
    [JENKINS] Archiving /data/jenkins/workspace/strongview-etl-core-Release4 - Latest Maven/pom.xml to tc.strongview/strongview-etl-core/0.2.0-SNAPSHOT/strongview-etl-core-0.2.0-SNAPSHOT.pom
    channel stopped
    Finished: FAILURE
    
  • H L
    H L almost 9 years
    Thank you very much for your help. I heeded your advices. I redid the release with latest maven-release-plugin 2.5.2 and both Maven 3.0.5 and 3.3.3. I also use the simple "-X release:prepare release:perform". (However, I keep the same SVN structure branches/releases & tags/releases .vs. branches/features & tags/features. We have 20 different Maven projects setup with this structure and they release properly to Nexus) So back to this new project with updated Maven and plugin, I still got the same error (new error log is posted above) . Thank you again for your insights/advices
  • Gustave
    Gustave almost 9 years
    A NPE is a strong indication that there could be a bug in the maven code.
  • H L
    H L almost 9 years
  • H L
    H L almost 9 years
  • H L
    H L almost 9 years
    It works properly for 20 other projs, just to show that the SVN structure probably not the cause of this problem (khmarbaise please correct me if I am wrong. Thank you)
  • rohit thomas
    rohit thomas almost 5 years
    Had the same translateUrlPath issue, solution for me, was that the scm was only mentioned in parent pom, so I added it to all child modules with their respective scm urls and it worked