Giter Site home page Giter Site logo

multi-module-sample's Introduction

Using maven-release-plugin and maven-scm-plugin to tag all submodules of a multimodule project

Rationale

In our company we have a policy that every released artifact should have a release tag in Subversion assuming tagging is a cheap operation in subversion.

So given a standard multimodule project:

foo/trunk/pom.xml (groupId=foo,artifactId=parent,version=1.0-SNAPSHOT)
foo/trunk/core/pom.xml
(groupId=foo,artifactId=core,parent=foo.parent:1.0-SNAPSHOT)
foo/trunk/app1/pom.xml
(groupId=foo,artifactId=app1,parent=foo.parent:1.0-SNAPSHOT)
foo/trunk/app2/pom.xml
(groupId=foo,artifactId=app2,parent=foo.parent:1.0-SNAPSHOT)

I want to have the following tags after running mvn -B release:prepare release:perform

foo/tags/parent-1.0
foo/tags/core-1.0
foo/tags/app1-1.0
foo/tags/app2-1.0

Each tag should contain the full trunk.

Let's say we deploy app1-1.8 and now want to fix a bug in this app. If we always copy the *whole trunk* beneath a tag called app1-1.8, we just have to checkout this tag and do not need to know, that version 1.8 of app1 is found in SVN beneath a tag called parent-1.8.

It is our policy that all components beneath a common trunk are strongly coupled and should all be released newly if something changes beneath it. We have used this scheme for a couple of years now, not only with maven but with C++ and Python projects as well, where one Makefile could produce several RPMs and implemented automated checks for getting postings to a newsgroup with the last QA notes from the former release and doing a quick gatekeeper code review in our QA team examining the diff between the last releases to make sure hotfixes do really only fix the hot issue(s) :-).

How it works

  • First of all you need to configure the maven-release-plugin in your parent pom.xml to use an additional releaseProfile.
  • In this profile you configure the maven-scm-plugin depending on your SCM.
  • In your submodules, make sure to include the maven-scm-plugin in the build section.
  • For SVN you need to make sure, that your submodules use the same URLs as the parent project, otherwise not the trunk but only the submodule will be tagged.

How to use this example with SVN

  • You need Maven 3 to get this running, there is still an issue with Maven2 during deployment with this pom.
  • Check out the repository. Remove the .git directory, it is not needed.
  • Create a local subversion repository beneath svnadmin create /Software/nobackup/svnrepo/.
  • Create the needed sub directories:
    • svn mkdir -m 'Initial' file:///Software/nobackup/svnrepo/multimodule/
    • svn mkdir -m 'Initial' file:///Software/nobackup/svnrepo/multimodule/releases
  • Import the project: svn import -m'Initial' . file:///Software/nobackup/svnrepo/multimodule/trunk
  • Checkout the project into another location: svn co file:///Software/nobackup/svnrepo/multimodule/trunk /tmp/multi-module-svn/
  • Switch to /tmp/multi-module-svn/
  • Adapt the distributionManagement section.
  • Commit your changes.
  • Run mvn clean deploy to deploy a SNAPSHOT.
  • Run mvn -B release:prepare release:perform.

How to use this example with GIT

  • Check out the repository to ${user.home}/Documents/workspace/multimodule.
  • Switch to git branch: git checkout git
  • Adapt the distributionManagement section.
  • Commit your changes.
  • Run mvn clean deploy to deploy a SNAPSHOT.
  • Run mvn -B release:prepare release:perform.

multi-module-sample's People

Contributors

mfriedenhagen avatar

Watchers

James Cloos avatar praveen20187 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.