Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Profile activation on both release:prepare and release:perform

I cannot find a solution for activating some Maven profile on release:prepare and release:perform (both) goals. Something like this:

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-release-plugin</artifactId>
  <version>2.2.1</version>
  <configuration>
    <useReleaseProfile>false</useReleaseProfile>
    <goals>deploy</goals>
    <arguments>-Pmy-release</arguments>
  </configuration>
</plugin>

just doesn't work. I know that releaseProfiles setting works only during release:perform so I just though that arguments setting is exactly what I want, but my-profile profile is not active during the execution. Am I doing something wrong?

like image 981
Michał Kalinowski Avatar asked Apr 03 '12 14:04

Michał Kalinowski


People also ask

What is release perform?

release:perform will fork a new Maven instance to build the checked-out project. This new Maven instance will use the same system configuration and Maven profiles used by the one running the release:perform goal.

What is Maven release profile?

The main aim of the maven-release plugin is to provide a standard mechanism to release project artifacts outside the immediate development team. The plugin provides basic functionality to create a release and to update the project's SCM accordingly.

What is Maven SCM?

Maven SCM supports Maven plugins (for example maven-release-plugin) and other tools by providing them with a common API for source code management operations. You can look at the list of SCMs for more information on using Maven SCM with your favorite SCM tool.


2 Answers

This looks like a duplicate question. Please take a look at this question, it has an answer. maven release plugin ignores releaseProfile

Basically version 2.2.1 of the release plugin adds a releaseProfiles parameter that will allow you to define the profiles to enable during release.

http://maven.apache.org/plugins/maven-release-plugin/examples/perform-release.html

Unfortunately, it looks like there's a bug that will prohibit it from doing what you want...

Edit

One thing that I have used in this case is not using the -P argument, but rather triggering the profile through an environment setting using -Denv=release. Then in the POM, I have the profile activation based on the value of env. This has always worked for me.

like image 52
nwinkler Avatar answered Oct 31 '22 16:10

nwinkler


-Darguments="-PmyProfile" seems to do the job.

like image 42
Cristian Botiza Avatar answered Oct 31 '22 17:10

Cristian Botiza