[ https://issues.apache.org/jira/browse/MNG-5490?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Christian Schulte updated MNG-5490: ----------------------------------- Labels: close-pending (was: ) > Add support for "lifecycle" activation for profiles > --------------------------------------------------- > > Key: MNG-5490 > URL: https://issues.apache.org/jira/browse/MNG-5490 > Project: Maven > Issue Type: Improvement > Components: Profiles > Affects Versions: 2.2.1 > Environment: Windows 7 > Reporter: Gregory Baumgardner > Priority: Minor > Labels: close-pending > > 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 was sent by Atlassian JIRA (v6.3.4#6332)