systemboot
systemboot

Reputation: 862

Maven Release plugin, version plugins and snapshots

I am trying to automate the release of interdependent projects. Here is the scenario. I have two projects: A and B. Project B has a dependency on project A. Here are the steps that need to happen in the automated procedure:

  1. Release project A using maven-release-plugin. ( I know how to do this). Here is the sequence of goals I have defined: release:clean release:prepare -DcommitByProject=true -DautoVersionSubmodules=true release:perform
  2. Deploy the latest SNAPSHOT version of project A to the repository. (Using simply deploy is working. However there is a slight catch, which I've described below.)

  3. Update the SNAPSHOT dependency version of project A in project B to the latest release version before doing a full release. In order to achieve this I've set the preparationGoals like this (clean verify versions:use-latest-versions versions:commit) in project B's POM file.

Everything seems to work fine.

Now what I want is that once the release is complete, Project A dependency in Project B to the latest SNAPSHOT version that was set during the release by the release:prepare plugin.

The solution I came up with was to do a maven deploy for project A SNAPSHOT right after the release:perform was executed. (New goal sequence for project A: release:clean release:prepare -DcommitByProject=true -DautoVersionSubmodules=true release:perform clean install deploy)

Then, I can execute a versions:use-next-snapshots at the end of the project B's release cycle. (New goal sequence for project B: release:clean release:prepare -DcommitByProject=true -DautoVersionSubmodules=true release:perform versions:use-next-snapshots). Here I do restrict my versions plugin to handle only Project A dependencies.

The trouble is that when I execute the goals for Project A. Maven deploys the SNAPSHOT with the old version and not the incremented version. So if version before release for project A was 1.1-SNAPSHOT. The version after release is now 1.2-SNAPSHOT. The release version will be 1.1. However, project A snapshot version deployed is 1.1-SNAPSHOT and not 1.2-SNAPSHOT.

I am guessing that maven is not updating the pom in memory after the maven-release-plugin goals are executed.

Upvotes: 0

Views: 940

Answers (1)

Steven
Steven

Reputation: 3894

have you considered making both projects belong to a parent project. then you release the parent project which in turn releases each module (sub project) automatically

Upvotes: 1

Related Questions