You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Jason van Zyl (JIRA)" <ji...@codehaus.org> on 2014/01/23 18:44:49 UTC

[jira] (MNG-5490) Add support for "lifecycle" activation for profiles

    [ https://jira.codehaus.org/browse/MNG-5490?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=339898#comment-339898 ] 

Jason van Zyl commented on MNG-5490:
------------------------------------

I honestly can't tell what you're trying to accomplish.
                
> Add support for "lifecycle" activation for profiles
> ---------------------------------------------------
>
>                 Key: MNG-5490
>                 URL: https://jira.codehaus.org/browse/MNG-5490
>             Project: Maven 2 & 3
>          Issue Type: Improvement
>          Components: Profiles
>    Affects Versions: 2.2.1
>         Environment: Windows 7
>            Reporter: Gregory Baumgardner
>            Priority: Minor
>
> I have the following scenario: Initialization step is done in the default lifecycle "initialize" phase which sets properties that are used in later build phases.  Unfortunately, the same properties need set in the "clean" lifecycle in order to use them in the clean phase.  There is no way to easily run the same execution of plugins without duplication.  However, it turns out very easy to manipulate the phase attribute in the following way:
> <profile>
>   <id>default-phase</id>
>   <activation>
>     <property>
>       <name>!clean-all</name>
>     </property>
>   </activation>
>   <properties>
>     <init-phase>initialize</init-phase>
>   </properties>
> </profile>
> <profile>
>   <id>clean-phase</id>
>   <activation>
>     <property>
>       <name>clean-all</name>
>     </property>
>   </activation>
>   <properties>
>     <init-phase>pre-clean</init-phase>
>   </properties>
> </profile>
> <profile>
>   <id>plugin-config</id>
>   <activation>
>     <property>
>       <name>java.version</name> <!-- Always on -->
>     </property>
>   </activation>
>   <build>
>     <plugins>
>       <plugin>
>    ... <!-- Whatever plugin -->
>          <executions>
>            <execution>
>              <id>initialize properties</id>
>              <goals><goal><!--The goal --></goal></goals>
>              <phase>${init-phase}</phase>
>              <configuration>
>                <!-- The plugin config to use -->
>              </configuration>
>            </execution>
>          </executions>
>        </plugin>
>       ...
>     </plugins>
>   </build>
> </profile>
> This will run the initialize step under initialize phase for default lifecycle and under pre-clean phase for clean lifecycle provided that the config information falls after the property set in a profile.  However, the one issue I have with this is that it requires you to run Maven with -Dclean-all property on the command line.  It would be even better if there was an activation for <lifecycle> that could be set to "default", "clean", "site", etc.  Then, the activation can occur when that specific lifecycle is invoked during the build.  As far as I can tell, there is no other way to determine this information.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira