My new website on Artificial Intelligence and Machine Learning www.aimlfront.com

Maven SCM tags, Maven Release

SCM

SCM (Software Configuration Management, also called Source Code/Control Management or, succinctly, version control) is an integral part of any healthy project. If your Maven project uses an SCM system (it does, doesn't it?) then here is where you would place that information into the POM.

<project xmlns="http://maven.apache.org/POM/4.0.0"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
	http://maven.apache.org/xsd/maven-4.0.0.xsd">
	...
	<scm>
		<connection>scm:svn:http://127.0.0.1/websvn/my-project</connection>
		<developerConnection>scm:svn:http://127.0.0.1/websvn/my-project </developerConnection>
		<tag>HEAD</tag>
		<url>http://127.0.0.1/websvn/my-project</url>
	</scm>
	...
</project>
  • connection, developerConnection: The two connection elements convey to how one is to connect to the version control system through Maven. Where connection requires read access for Maven to be able to find the source code (for example, an update), developerConnection requires a connection that will give write access. The Maven project has spawned another project named Maven SCM, which creates a common API for any SCMs that wish to implement it. The most popular are CVS and Subversion, however, there is a growing list of other supported SCMs. All SCM connections are made through a common URL structure. scm:[provider]:[provider_specific]
    Where provider is the type of SCM system. For example, connecting to a CVS repository may look like this:
    scm:cvs:pserver:127.0.0.1:/cvs/root:my-project
  • tag: Specifies the tag that this project lives under. HEAD (meaning, the SCM root) should be the default.
  • url: A publicly browsable repository. For example, via ViewCVS.

Maven Release in Jenkins


For maven release above scm tags are very important, based on those tags it will try to access SVN from maven.

1. Maven release for parent pom(parent)

First we need to check "scm" tags are available as per SVN location in pom.xml. I have provided below scm tags as per 1.0.1_Refactor code.

<scm>
	<connection>scm:svn:http://svn.javavillage.com/svn/branches/
						1.0.1_Refactor/webservices/</connection>
	<developerConnection>scm:svn:http://svn.javavillage.com/svn/branches/
						1.0.1_Refactor/webservices/</developerConnection>
	<url>http://svn.javavillage.com/svn/branches/
						1.0.1_Refactor/webservices/</url>
</scm>

2. Maven release for childprojects(mail,sms service)

First we need to update the parent version with release version (not development version) from above in pom.xml for child projects like below.

   Mail Service:
<parent>
	<groupId>com.javavillage </groupId>
	<artifactId>mail-service</artifactId>
	<version>1.102.01</version>
</parent>

Note: don't forget to use parent version after maven release.
Version: 1.102.01(Maven released parent version)

   Scm changes :

	<scm>
	    <connection>scm:svn:http://svn.javavillage.com/svn/branches/1.0.1_Refactor/
					webservices/mail</connection>
	    <developerConnection>scm:svn:http://svn.javavillage.com/svn/branches/
					1.0.1_Refactor/webservices/mail</developerConnection>
	    <url>http://svn.javavillage.com/svn/branches/1.0.1_Refactor/
					webservices/mail</url>
	</scm>