[ http://jira.codehaus.org/browse/MNG-835?page=comments#action_46255 ] 

Mark Hobson commented on MNG-835:
---------------------------------

I'm currently using profiles to augment the normal build resources and 
configure plugins for deployment, for example:

<project>
        ...
        <profiles>
                <profile>
                        <id>default</id>
                        <activation>
                                <property>
                                        <name>profile</name>
                                        <value>default</value>
                                </property>
                        </activation>
                        <build>
                                <resources>
                                        <resource>
                                                
<directory>src/profiles/default/resources</directory>
                                        </resource>
                                </resources>
                                <plugins>
                                        ...
                                </plugins>
                        </build>
                </profile>
                <profile>
                        <id>live</id>
                        <activation>
                                <property>
                                        <name>profile</name>
                                        <value>live</value>
                                </property>
                        </activation>
                        <build>
                                <finalName>ROOT</finalName>
                                <resources>
                                        <resource>
                                                
<directory>src/profiles/live/resources</directory>
                                        </resource>
                                </resources>
                                <plugins>
                                        ...
                                </plugins>
                        </build>
                </profile>
        </profiles>
        ...
</project>

Ideally I'd remove the activation block for both in preference to using the -P 
switch at buildtime.  Although of course one profile needs to activated, hence 
the need to specify a default profile.  Does this make sense or do you see a 
better way of achieving this?

> Default profile in pom.xml not activated
> ----------------------------------------
>
>          Key: MNG-835
>          URL: http://jira.codehaus.org/browse/MNG-835
>      Project: Maven 2
>         Type: Bug
>   Components: maven-core
>     Versions: 2.0-alpha-3
>     Reporter: Vincent Massol
>     Assignee: John Casey
>      Fix For: 2.0-beta-2

>
> Original Estimate: 3 hours
>         Remaining: 3 hours
>
> Pasted email from mailing list explaining the problem. I've also ran "m2 
> projecthelp:active-profiles" and it doesn't show the profile as active.
> ---
> Hi,
> I want to allow cargo build users to override a plugin property. I have seen 
> that using a <build> element is not allowed in a settings.xml file and Brett 
> has suggested I use a <properties> element instead. However I also need to 
> define a default value for the property that can be overridden.
> Thus I have defined the following in my project's pom.xml:
> [...]
>   <build>
>     <plugins>
>       <plugin>
>         <artifactId>maven-surefire-plugin</artifactId>
>         <configuration>
>           <systemProperties combine.children="append">
>             <property>
>               <name>cargo.containers</name>
>               <value>${cargo.containers}</value>
>             </property>
> [...]
>           </systemProperties>
>         </configuration>
>       </plugin>
>     </plugins>
>   </build>
>   <profiles>
>     <profile>
>       <id>default</id>
>       <properties>
>         <cargo.containers>jetty4xEmbedded</cargo.containers>
>       </properties>
>     </profile>
>   </profiles>
> </project>
> I want cargo build users to be able to create a settings.xml file with the 
> following for example:
> <settings>
>   <profiles>
>     <profile>
>       <id>user-vmassol</id>
>       <properties>
>         <cargo.containers>resin3x</cargo.containers>
>       </properties>
>     </profile>
>   </profiles>
>   <activeProfiles>
>     <activeProfile>user-vmassol</activeProfile>
>   </activeProfiles>
> </settings>
> Is that the correct way to implement my use case?
> So far, the issue I've had is that the default profile created in pom.xml is 
> not used when I issue a "m2 install" command. I've read on 
> http://docs.codehaus.org/display/MAVEN/Build+Profiles that naming a profile 
> "default" will automatically activate it. Isn't that so?
> If not how can I activate a profile defined in pom.xml by default?
> Thanks a lot
> -Vincent

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to