tags:

views:

35

answers:

1

Hi

i am using to profiles: development and production

development should be active on default, production should be used when i am releasing.

In my pom.xml i have:

[...]
<plugin>
<artifactId>maven-release-plugin</artifactId>
<version>2.0-beta-9</version>
<configuration>
  <useReleaseProfile>false</useReleaseProfile>
  <goals>deploy</goals>
  <arguments>-Pproduction</arguments>
</configuration>
</plugin>
[...]
<profiles>
  <profile>
    <id>production</id>
    <properties>
      <profile.name>production</profile.name>
    </properties>
    [...]
  </profile>
  <profile>
    <id>development</id>
    <activation>
      <activeByDefault>true</activeByDefault>
    </activation>
    <properties>
    <profile.name>development</profile.name>
    </properties>
       [...]
  </profile>
[...]

It just does not work.
useReleaseProfiles doen't work either: http://jira.codehaus.org/browse/MRELEASE-459

development profile should be always active but not when running mvn release:perform How can you achieve this?

[UPDATE]: I have seen with the debug flag that my production profile is used, but development profile is used too, because it is activeByDefault. This cant be overridden by releaseProfile argument. It would be nice to force the release plugin to use only "production" profile

A: 

I think you should simply activate your profiles through a property.

<profiles>
  <profile>
    <id>production</id>
    <activation>
      <property>
        <name>build</name>
        <value>release</value>
      </property>
    </activation>
    [...]
  </profile>
  <profile>
    <id>development</id>
    <activation>
      <property>
        <name>build</name>
        <value>develop</value>
      </property>
    </activation>
    [...]
  </profile>
<profiles>

Do your builds by executing something like this

mvn -Dbuild=develop package
mvn -Dbuild=develop test

mvn -Dbuild=release release:prepare
mvn -Dbuild=release release:perform
splash
yes, i did already know that it is possible to set the profile like this. But this way it can be forgotton. If you forget it, the released package would contain wrong configuration files and deployment would fail. I would like to enforce the release plugin to use only the given profile.
Janning
It can't be forgotten if you define some properties in the profiles which are required and used by the release plugin.
splash
I do not understand your last comment. Could you please explain it to me?
Janning