How to create a custom lifecycle mapping to facilitate releases

123 views Asked by At

I've been working with the release plugin, but am trying to automate its solution a little for our needs.

At the moment, all our builds run the following command:

mvn clean initialize release:prepare release:perform

While that's functional, it's not as concise as I would like it. I have a few plugins defined in my super-pom which are activated during the initialize phase and are required before the release plugin is run. Ideally, I would like to see my command as something like:

mvn doMyRelease

which in turn calls the necessary phases/goals of the different plugins.

Additionally, I'd like to create a phase called doMyStage which would do the following:

mvn clean initialize release:prepare release:stage

I figure that a custom plugin with a custom lifecycle is the way to go about this, but I am confused how to accomplish this. From what I read, the lifecycle is mapped to the packaging type. I do not wish to change the packaging type of any of my projects (as their packaging remains correct), but rather just provide a shortcut for the build command line.

I'm also having trouble finding a good tutorial/working maven 3 example for this concept. Most examples I see all refer to a components.xml file, but I read that this has been replaced with a default-bindings.xml descriptor in Maven 3.

I found this article https://developer.jboss.org/wiki/CreatingaCustomLifecycleinMaven?_sscc=t which touches a little on the issue, but like most examples, it requires changing the packaging type to match the lifecycle hint.

Is there a way to accomplish this?

0

There are 0 answers