You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Carlos Chávez <cc...@agssa.net> on 2008/12/15 23:56:10 UTC

Problems with maven 2.0.9, 2.1.0-M1 and profiles.

Hello everyone.

I have defined in a parent POM some profiles and some properties,
then in the child profile i have defined some resources
that use those properties, it looks like:

parent POM:

<project>
...
...
<profiles>
    <profile>
      <id>local</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
      <properties>
        <gator.smtp.server>localhost</gator.smtp.server>
        <gator.smtp.from>root@localhost</gator.smtp.from>   
        <store-janitor.freememory>2048000</store-janitor.freememory>
        <store-janitor.heapsize>66600000</store-janitor.heapsize>   
      </properties>
    </profile>
    <profile>
      <id>gator</id>
      <properties>
        <gator.smtp.server>server.com.ni</gator.smtp.server>
        <gator.smtp.from>sistema@server.com.ni</gator.smtp.from>
        <store-janitor.freememory>10737000</store-janitor.freememory>
        <store-janitor.heapsize>526133000</store-janitor.heapsize>
      </properties>
    </profile>
  </profiles>
</project>


The following is the child POM:

  <build>
  ...
  ...
    <resources>
      <resource>
        <directory>src/main/resources</directory>
        <filtering>true</filtering>
      </resource>
      <resource>
        <directory>src/main/webapp/WEB-INF/properties</directory>
        <filtering>true</filtering>
        <targetPath>../gator/WEB-INF/properties</targetPath>
      </resource>
    </resources>
  </build>

There is a file in src/main/webapp/WEB-INF/properties with the following:

# smtp properties
gator.smtp.server = ${gator.smtp.server}
gator.smtp.from = ${gator.smtp.from}

This configuration work perfectly on maven 2.0.7, the maven build
depending on the profile change the properties for his value. Now in
maven 2.0.9 and 2.1.0-M1 this configuration seems like is not working,
there is no error messages or warning.

The other issue is that i can not override a property defined in the POM
by a property from the command line.

--
Cheers.
Carlos Chávez.


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


Re: Problems with maven 2.0.9, 2.1.0-M1 and profiles.

Posted by Jörg Schaible <jo...@gmx.de>.
Arnaud HERITIER wrote:

> What I learned recently is that activation of profiles isn't inherited.
> Can't it be your problem ? By default in a child project you won't have
> access to the properties values defined in the local profile.

For us it is using M209! However, we do not use the activationByDefault, but
the activeProfiles section. Any profile added there is also active in the
children.

- Jörg


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


Re: Problems with maven 2.0.9, 2.1.0-M1 and profiles.

Posted by Arnaud HERITIER <ah...@gmail.com>.
What I learned recently is that activation of profiles isn't inherited.
Can't it be your problem ? By default in a child project you won't have
access to the properties values defined in the local profile.

Arnaud


On Mon, Dec 15, 2008 at 11:56 PM, Carlos Chávez <cc...@agssa.net> wrote:

> Hello everyone.
>
> I have defined in a parent POM some profiles and some properties,
> then in the child profile i have defined some resources
> that use those properties, it looks like:
>
> parent POM:
>
> <project>
> ...
> ...
> <profiles>
>    <profile>
>      <id>local</id>
>      <activation>
>        <activeByDefault>true</activeByDefault>
>      </activation>
>      <properties>
>        <gator.smtp.server>localhost</gator.smtp.server>
>        <gator.smtp.from>root@localhost</gator.smtp.from>
>        <store-janitor.freememory>2048000</store-janitor.freememory>
>        <store-janitor.heapsize>66600000</store-janitor.heapsize>
>      </properties>
>    </profile>
>    <profile>
>      <id>gator</id>
>      <properties>
>        <gator.smtp.server>server.com.ni</gator.smtp.server>
>        <gator.smtp.from>sistema@server.com.ni</gator.smtp.from>
>        <store-janitor.freememory>10737000</store-janitor.freememory>
>        <store-janitor.heapsize>526133000</store-janitor.heapsize>
>      </properties>
>    </profile>
>  </profiles>
> </project>
>
>
> The following is the child POM:
>
>  <build>
>  ...
>  ...
>    <resources>
>      <resource>
>        <directory>src/main/resources</directory>
>        <filtering>true</filtering>
>      </resource>
>      <resource>
>        <directory>src/main/webapp/WEB-INF/properties</directory>
>        <filtering>true</filtering>
>        <targetPath>../gator/WEB-INF/properties</targetPath>
>      </resource>
>    </resources>
>  </build>
>
> There is a file in src/main/webapp/WEB-INF/properties with the following:
>
> # smtp properties
> gator.smtp.server = ${gator.smtp.server}
> gator.smtp.from = ${gator.smtp.from}
>
> This configuration work perfectly on maven 2.0.7, the maven build
> depending on the profile change the properties for his value. Now in
> maven 2.0.9 and 2.1.0-M1 this configuration seems like is not working,
> there is no error messages or warning.
>
> The other issue is that i can not override a property defined in the POM
> by a property from the command line.
>
> --
> Cheers.
> Carlos Chávez.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>


-- 
..........................................................
Arnaud HERITIER
12 guidelines to boost your productivity with a Java software factory -
http://tinyurl.com/56s9tw
..........................................................
OCTO Technology - aheritier AT octo DOT com
www.octo.com | blog.octo.com
..........................................................
ASF - aheritier AT apache DOT org
www.apache.org | maven.apache.org
...........................................................

Re: Problems with maven 2.0.9, 2.1.0-M1 and profiles.

Posted by Carlos Chávez <cc...@agssa.net>.
Hi everyone, thanks for the answer.

Want i found now, is that i need to run two times the install goal in
order to get the substitution of the variables.

mvn -Pgator clean install - The variables don't work.

So i have to do:

mvn clean
mvn -Pgator install - The variables don't work.
mvn -Pgator install - Second time, the variables work.

--
Cheers.
Carlos Chávez. 

Carlos Chávez escribió:
> Hello everyone.
>
> I have defined in a parent POM some profiles and some properties,
> then in the child profile i have defined some resources
> that use those properties, it looks like:
>
> parent POM:
>
> <project>
> ...
> ...
> <profiles>
>     <profile>
>       <id>local</id>
>       <activation>
>         <activeByDefault>true</activeByDefault>
>       </activation>
>       <properties>
>         <gator.smtp.server>localhost</gator.smtp.server>
>         <gator.smtp.from>root@localhost</gator.smtp.from>   
>         <store-janitor.freememory>2048000</store-janitor.freememory>
>         <store-janitor.heapsize>66600000</store-janitor.heapsize>   
>       </properties>
>     </profile>
>     <profile>
>       <id>gator</id>
>       <properties>
>         <gator.smtp.server>server.com.ni</gator.smtp.server>
>         <gator.smtp.from>sistema@server.com.ni</gator.smtp.from>
>         <store-janitor.freememory>10737000</store-janitor.freememory>
>         <store-janitor.heapsize>526133000</store-janitor.heapsize>
>       </properties>
>     </profile>
>   </profiles>
> </project>
>
>
> The following is the child POM:
>
>   <build>
>   ...
>   ...
>     <resources>
>       <resource>
>         <directory>src/main/resources</directory>
>         <filtering>true</filtering>
>       </resource>
>       <resource>
>         <directory>src/main/webapp/WEB-INF/properties</directory>
>         <filtering>true</filtering>
>         <targetPath>../gator/WEB-INF/properties</targetPath>
>       </resource>
>     </resources>
>   </build>
>
> There is a file in src/main/webapp/WEB-INF/properties with the following:
>
> # smtp properties
> gator.smtp.server = ${gator.smtp.server}
> gator.smtp.from = ${gator.smtp.from}
>
> This configuration work perfectly on maven 2.0.7, the maven build
> depending on the profile change the properties for his value. Now in
> maven 2.0.9 and 2.1.0-M1 this configuration seems like is not working,
> there is no error messages or warning.
>
> The other issue is that i can not override a property defined in the POM
> by a property from the command line.
>
> --
> Cheers.
> Carlos Chávez.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>   


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