You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Laura Hinojosa <lh...@objectwave.com> on 2006/12/05 17:44:05 UTC

Properties in profiles

Hi all!
 
I'm trying to create a pom for my project that has two different deployment environments, which are mutually exclusive, but I need to have one by default.
 
I tried using properties but even when maven-help-plugin tells me the correct profile gets activated and the effective pom is correct, seems that the properties don't get overwritten.  Here is what I'm doing:
 
<project>

...

<properties>

   <buildState>dev</buildState>

   <jr2DeployPath>/devDeployPath</jr2DeployPath>

   <repositoryURL>http://developmentRepository</repositoryURL>

</properties>

<repositories>

   <repository>

        <id>alm-${buildState}</id>

        <url>${repositoryURL}</url>

   </repository>

</repositories>

<pluginRepositories>

   <pluginRepository>

        <id>alm-${buildState}</id>

        <url>${repositoryURL}</url>

   </pluginRepository>

</pluginRepositories>

<profiles>

   <profile>

        <id>prod</id>

        <properties>

             <buildState>prod</buildState>

             <jr2DeployPath>/repos/HCOI/R2-ALM/repository/group-m2</jr2DeployPath>

             <repositoryURL>http://r2alm.ghq.hsbc:8080/alm/proxy/hsbc/group-m2</repositoryURL>

        </properties>

   </profile>

</profiles>

<build>

   <plugins> 

        <plugin>

             <groupId>com.mygroup</groupId>

             <artifactId>maven-my-plugin</artifactId>

             <version>1.0.1</version>

             <extensions>true</extensions>

             <configuration>

             <jr2Deploy>

                <path>${jr2DeployPath}</path>

             </jr2Deploy>

        </configuration>

   </plugin> 

</plugins>

</build>

...

</project>

And even when I execute this pom, activating the profile with -Pprod, the development path and repository are active.  Looks like the profile's properties can't overwrite those from the main pom.  Is that the case?? or am I doing something wrong?

Thanks for your help

Laura Hinojosa


------------------------------------------------

This e-mail, and any attachments thereto, is confidential and is intended only for the individual(s) named.  If you are not the intended recipient, please let us know by e-mail reply and delete it from your system; do not copy/save this e-mail or disclose its contents to anyone.  E-mail transmissions cannot be guaranteed to be secure or error-free as the transmission could be interrupted, corrupted, lost, destroyed, altered, arrive late or contain viruses.  ObjectWave does not accept liability for any errors or omissions in the contents of this e-mail which arise as a result of e-mail transmission.  The views expressed in this e-mail do not necessarily reflect those of ObjectWave or its affiliates.

------------------------------------------------



Re: Properties in profiles

Posted by Tom Huybrechts <to...@gmail.com>.
Try creating two profiles, and set one to
<activeByDefault>true</activeByDefault>.
Don't set any properties in the main section of the pom.

On 12/5/06, Laura Hinojosa <lh...@objectwave.com> wrote:
> Hi all!
>
> I'm trying to create a pom for my project that has two different deployment environments, which are mutually exclusive, but I need to have one by default.
>
> I tried using properties but even when maven-help-plugin tells me the correct profile gets activated and the effective pom is correct, seems that the properties don't get overwritten.  Here is what I'm doing:
>
> <project>
>
> ...
>
> <properties>
>
>    <buildState>dev</buildState>
>
>    <jr2DeployPath>/devDeployPath</jr2DeployPath>
>
>    <repositoryURL>http://developmentRepository</repositoryURL>
>
> </properties>
>
> <repositories>
>
>    <repository>
>
>         <id>alm-${buildState}</id>
>
>         <url>${repositoryURL}</url>
>
>    </repository>
>
> </repositories>
>
> <pluginRepositories>
>
>    <pluginRepository>
>
>         <id>alm-${buildState}</id>
>
>         <url>${repositoryURL}</url>
>
>    </pluginRepository>
>
> </pluginRepositories>
>
> <profiles>
>
>    <profile>
>
>         <id>prod</id>
>
>         <properties>
>
>              <buildState>prod</buildState>
>
>              <jr2DeployPath>/repos/HCOI/R2-ALM/repository/group-m2</jr2DeployPath>
>
>              <repositoryURL>http://r2alm.ghq.hsbc:8080/alm/proxy/hsbc/group-m2</repositoryURL>
>
>         </properties>
>
>    </profile>
>
> </profiles>
>
> <build>
>
>    <plugins>
>
>         <plugin>
>
>              <groupId>com.mygroup</groupId>
>
>              <artifactId>maven-my-plugin</artifactId>
>
>              <version>1.0.1</version>
>
>              <extensions>true</extensions>
>
>              <configuration>
>
>              <jr2Deploy>
>
>                 <path>${jr2DeployPath}</path>
>
>              </jr2Deploy>
>
>         </configuration>
>
>    </plugin>
>
> </plugins>
>
> </build>
>
> ...
>
> </project>
>
> And even when I execute this pom, activating the profile with -Pprod, the development path and repository are active.  Looks like the profile's properties can't overwrite those from the main pom.  Is that the case?? or am I doing something wrong?
>
> Thanks for your help
>
> Laura Hinojosa
>
>
> ------------------------------------------------
>
> This e-mail, and any attachments thereto, is confidential and is intended only for the individual(s) named.  If you are not the intended recipient, please let us know by e-mail reply and delete it from your system; do not copy/save this e-mail or disclose its contents to anyone.  E-mail transmissions cannot be guaranteed to be secure or error-free as the transmission could be interrupted, corrupted, lost, destroyed, altered, arrive late or contain viruses.  ObjectWave does not accept liability for any errors or omissions in the contents of this e-mail which arise as a result of e-mail transmission.  The views expressed in this e-mail do not necessarily reflect those of ObjectWave or its affiliates.
>
> ------------------------------------------------
>
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org