You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Brian Burridge <br...@burridge.net> on 2006/03/10 16:28:47 UTC

Altering plugin configuration based on lifecycle phase?

Is it possible to have different configurations for a plugin based on
lifecycle phase?

Here is an example, with using the tomcat plugin.
I currently have the following configuration which allows me to deploy the
Maven built WAR into my local tomcat server:

    *<plugin>*
	    *<groupId>*org.codehaus.mojo*</groupId>*
	    *<artifactId>*tomcat-maven-plugin*</artifactId>*
	    *<version>*1.0-SNAPSHOT*</version>*
	    *<configuration>*
		    *<server>*MyLocalTomcatServer*</server>*
	    *</configuration>*
    *</plugin>*

I would like it to be configured that way up until the integration-test
phase, when I would like to change the server specified so that it switches
to deploy the WAR remotely.

Brian N. Burridge

Re: Altering plugin configuration based on lifecycle phase?

Posted by Wayne Fay <wa...@gmail.com>.
Sure. Here's an example:

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-antrun-plugin</artifactId>
        <version>1.1</version>
        <executions>
          <execution>
            <id>proc</id>
            <phase>process-resources</phase>
            <configuration>
              <tasks>
                <echo>this is maven-antrun-plugin : process-resources</echo>
              </tasks>
            </configuration>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
          <execution>
            <id>pkg</id>
            <phase>package</phase>
            <configuration>
              <copy file="${basedir}/../Lib/target/lib-2.1.2.jar"
tofile="${basedir}/target/classes/lib/lib-2.1.2.jar"/>
            </configuration>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
          <execution>
            <id>dep</id>
            <phase>deploy</phase>
            <configuration>
              <tasks>
                <echo message="Deploying..."/>
              </tasks>
            </configuration>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
        </executions>

You'll want to make something similar with Executions and
Configurations specific to your usage.

Wayne


On 3/10/06, Brian Burridge <br...@burridge.net> wrote:
> Is it possible to have different configurations for a plugin based on
> lifecycle phase?
>
> Here is an example, with using the tomcat plugin.
> I currently have the following configuration which allows me to deploy the
> Maven built WAR into my local tomcat server:
>
>    *<plugin>*
>            *<groupId>*org.codehaus.mojo*</groupId>*
>            *<artifactId>*tomcat-maven-plugin*</artifactId>*
>            *<version>*1.0-SNAPSHOT*</version>*
>            *<configuration>*
>                    *<server>*MyLocalTomcatServer*</server>*
>            *</configuration>*
>    *</plugin>*
>
> I would like it to be configured that way up until the integration-test
> phase, when I would like to change the server specified so that it switches
> to deploy the WAR remotely.
>
> Brian N. Burridge
>
>