This section describes how you can release the workspace with Maven and upload the artifacts to
a repository. Before you continue, make sure you have configured the scm
and
distributionManagement
section as described in the
Section 3.3.3, “Configuring the Workspace”.
At the heart of every release process is the maven-release-plugin
, which divides
the process into two phases, the prepare
and the perform
phase.
In the prepare
phase Maven sets a release version, builds the workspace and if that
succeeds, it commits and tags the state. In a second step the version is bumped up to the next
SNAPSHOT
version.
During the perform
phase the release committed tag is being checked out to the
target/checkout
directory, from where it is being build. During this
perform build, the release artifacts are being uploaded to a Maven repository.
The default call you need to execute is therefore:
$ cd $CM_BLUEPRINT_HOME $ mvn release:prepare release:perform
Upload Libraries, Components and Applications
During a release, you only need to upload the artifacts of the modules below the
$CM8_BLUEPRINT_HOME/modules
folder into a Maven repository as there is no
need to reuse the artifacts below the $CM8_BLUEPRINT_HOME/packages
folder
in other projects, they are for deployment purposes only. Because of this, the
maven-deploy-plugin
is configured to skip the deploy
goal for these
modules.
Upload Packages
Because there are Maven repository servers with the capability to serve a Maven repository with
artifacts of type rpm as a Yum repository, you will find a hook to the
$CM8_BLUEPRINT_HOME/boxes
module to upload the rpm artifacts to a dedicated
repository. Currently Nexus and Artifactory are supporting Yum
repositories.
To deploy RPM packages, you need to activate the Maven profile repository-upload
.
By default, the profile can be configured using the properties shown in the table below:
property | usage |
---|---|
| The URL to upload the artifacts to. Defaults to ${project.distributionManagement.repository.url}
|
|
The id of the server authentication in the settings.xml . Defaults to
${project.distributionManagement.repository.id}
|
Table 4.1. RPM deployment properties
Because repository servers like Nexus prohibit the deployment of snapshot artifacts into release
repository and vice versa, you need to overwrite the repository URL to upload snapshot RPM
artifacts. In case of a CI build you can then use a profile defined in the
settings.xml
file to overwrite the properties. In most cases there is
already such a snapshot profile to add snapshot repositories and you can reuse it. In any case,
the profile must include the properties, for example :
<profile> <rpm.upload.repository.url>REPO_URL</rpm.upload.repository.url> <rpm.upload.repository.id>REPO_ID</rpm.upload.repository.id> </profile>
Example 4.12. Snapshot Profile
To activate the hook during the Maven release, you need to add the profile to the comma
separated list of profiles defined in the releaseProfiles
configuration property of
the maven-release-plugin
. You can find the configuration in the
pluginManagement
section of the $CM7_BLUEPRINT_HOME/pom.xml
.
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>Configuration of maven-release-plugin</artifactId> <version>2.3.2</version> <configuration> <autoVersionSubmodules>true</autoVersionSubmodules> <pushChanges>false</pushChanges> <localCheckout>true</localCheckout> <preparationGoals>clean verify</preparationGoals> <releaseProfiles> postconfigure, repository-upload </releaseProfiles> <arguments>-Ppostconfigure</arguments> </configuration> </plugin>
Example 4.13. maven-release-plugin
If you want to upload the RPM artifacts manually, you need to execute the deploy
goal together with the profile, for example:
$ cd $CM7_BLUEPRINT_HOME/boxes $ mvn deploy -Prepository-upload
Upload RPM Archive to S3
If you want to deploy the system within Amazon EC2 there is another
hook to create an archive containing all RPM files and upload it to Amazon
S3. This hook can be activated with the Maven profile s3-upload
,
defined in the $CM7_BLUEPRINT_HOME/boxes/pom.xml
.
Upload Zip Packages
As there is no standardized deployment process for applications packaged as Zip files, there is
no preconfigured solution within the workspace as well. If you still want to upload the Zip
archives directly to their target machines, you can use the wagon-maven-plugin
to
achieve this. You will find the plugin's documentation
here.