Skip to content

Releasing a new Cobertura

Dennis Lundberg edited this page Mar 4, 2015 · 3 revisions

Prerequisites

Currently our release processes is done by using the maven-release-plugin.

  1. We perform a release through oss.sonatype.org. Follow the tutorial to get access to sonatype: https://docs.sonatype.org/display/Repository/Sonatype+OSS+Maven+Repository+Usage+Guide Make sure to follow steps 1-5.

  2. Modify your settings.xml file located in your ~/.m2 folder or wherever your root maven directory is located.

<settings>
  ...
  <servers>
    <server>
      <id>sonatype-nexus-snapshots</id>
      <username>your-jira-id</username>
      <password>your-jira-pwd</password>
    </server>
    <server>
      <id>sonatype-nexus-staging</id>
      <username>your-jira-id</username>
      <password>your-jira-pwd</password>
    </server>
  </servers>
  ...
</settings>

Make sure your-jira-id and your-jira-pwd are the same that you used when creating the jira in step 1.

Performing the release

Once all the prerequisites have been completed, execute the following commands:

mvn release:clean release:prepare

It will prompt for release versions and next release versions. Once the command above succeeds, then you can execute the final command:

mvn release:perform

Note: A lot of people the first time would run into the following issue with PKIX. Look below in the troubleshoot section to find out how to resolve that issue.

Post release tasks

After the release is done using Maven there are a few additional tasks that needs to be done as well:

Troubleshoot

PKIX Issue: If you try to execute mvn release:perform command and it fails with the following exception

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project cobertura-maven-plugin: Failed to deploy artifacts: Could not transfer artifact org.codehaus.mojo:cobertura-maven-plugin:jar:2.6 from/to codehaus-nexus-staging (https://oss.sonatype.org/service/local/staging/deploy/maven2/): sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target -> [Help 1]

Or anything very similar that means that your java trusted certificates list (jsscerts) does not contain an exception for oss.sonatype.org. To resolve this we need to add the oss.sonatype.org certificate to our list of accepted certificates. The guide below will show you how to do that with the help of portecle. First download http://portecle.sourceforge.net/, an open source java key managing tool. First go to https://oss.sonatype.org/service/local/staging/deploy/maven2 via a web browser and export the certificate. Next open portecle and go to File > Open keystore file and open your keystore file. If you do not know where it is or would like to create a new one then go to File > New Keystore File and select .jks file. Once the file is open go to Tools > Import Trusted Certificate. Next find your certificate that was just downloaded with your browser. Finally go to File > Save keystore and you are finished. Re-run the command and everything should be clean.