Building/Releasing projects with maven release plugin
This post describes about building/releasing projects with maven using the maven release plugin with org.wso2.maven:wso2-release-pre-prepare-plugin.
1. Checkout the svn repo and create two folders as tag and trunk.
2. Then you need to create a Maven Multi Module project called 'trunk' and then add following sections to the main pom.xml
<properties>
<project.scm.id>my.svn.server</project.scm.id>
</properties>
<scm>
<connection>scm:svn:http://127.0.0.1/subversion/sohani.repo/test9/trunk</connection>
<developerConnection>scm:svn:http://127.0.0.1/subversion/sohani.repo/test9/trunk</developerConnection>
<url>http://127.0.0.1/subversion/sohani.repo/test9/trunk</url>
</scm>
<plugin>
<artifactId>maven-release-plugin</artifactId>
<version>2.5</version>
<configuration>
<preparationGoals>clean</preparationGoals>
<completionGoals>org.wso2.maven:wso2-release-pre-prepare-plugin:1.1.0:pre-prepare</completionGoals>
<!-- This must be set! The plugin throws a NPE when not set -->
<tagBase>http://127.0.0.1/subversion/sohani.repo/test9/tags</tagBase>
</configuration>
</plugin>
<distributionManagement>
<repository>
<id>my-releases</id>
<url>http://localhost:8081/nexus/content/repositories/releases/</url>
</repository>
</distributionManagement>
<pluginRepository>
<id>wso2-public</id>
<url>http://maven.wso2.org/nexus/content/groups/wso2-public</url>
</pluginRepository>
3. In settings.xml resides at .m2, you need to add below sections.
<server>
<id>my-releases</id>
<username><nexus_uname></username>
<password><nexus_password></password>
</server>
<server>
<id>my.svn.server</id>
<username><svn_uname></username>
<password><svn_password></password>
</server>
<mirror>
<id>nexus</id>
<mirrorOf>*</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://localhost:8081/nexus/content/groups/public</url>
</mirror>
<profile>
<id>nexus</id>
<!--Enable snapshots for the built in central repo to direct -->
<!--all requests to nexus via the mirror -->
<repositories>
<repository>
<id>central</id>
<url>http://central</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<url>http://central</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
<activeProfile>nexus</activeProfile>
4. Then navigate to the checkout location (trunk) of the svn repo and execute below commands
mvn release:prepare -Dusername=<svn_uname> -Dpassword=<svn_password>
mvn release:perform
5. If you want to revert changes you can execute below commands
mvn release:rollback
mvn release:clean
No comments:
Post a Comment