Basically, this plugin automates a ton of the little manual steps that you have to go through every time you perform a release. It will:
- Increment the version number of the project in the pom
- Check the updated version number into svn
- Add a tag to the project in svn for the current release
- Compile, Test, Package
- Upload the packaged jar file to your local Maven repository
- Append “-SNAPSHOT” to the current version in the project pom for continued development
- Check the updated version number into svn
It makes a few assumptions in order to execute successfully:
- Before trying to release, all of your local changes must be checked in. It will only release what is current in svn.
- Your current version number, the first time you use this, must end with “-SNAPSHOT”
- You must have a local Maven repository set up
Once you have this all set up, then releasing a new version of your library becomes as easy as checking your regular code changes into svn and running a simple maven command. No more worrying about remembering to increment your version number, no more concern about not having things checked into svn. It mandates a lot of the best practices that one should be following anyway.
In order to get this set up, there are a handful of steps that must be followed:
- You must have the “svn” command on your command line execution path. For Windows, I downloaded and installed SlikSvn, which automatically adds the svn command to your path (requires a restart after installation)
- Add the following block to your project’s pom.xml at the top level under the root <project> node:
<scm> <connection>scm:svn:https://your.svn.url/ProjRoot</connection> <developerConnection>scm:svn:https://your.svn.url/ProjRoot</developerConnection> </scm>
- Add the following block to your project’s pom.xml under <build><plugins>:
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-release-plugin</artifactId> <version>2.1</version> </plugin>
- If you are not already set up to deploy to your local Maven repository, you need to add the following block under <build><extensions>
<extension> <groupId>org.apache.maven.wagon</groupId> <artifactId>wagon-webdav</artifactId> <version>1.0-beta-2</version> </extension>
- If you are not already set up to deploy to your local Maven repository, you need to add the following block under <distributionManagement>
<repository> <id>internal</id> <name>Internal Release Repository</name> <url>dav:http://your.internal.repository</url> </repository>
That's all there is to it. With a single command, you can now handle versioning, building, testing, and deploying of your java library.
No comments:
Post a Comment