Search code examples
mavenmaven-2

How do we run executions differently in local development machines and in deployment?


I want to use exploded wars (for speed) when developing locally, but create proper zipped wars when deploying to the cloud.

How do I run different executions in each environment?

<artifactId>maven-war-plugin</artifactId>
       <executions>
            <execution>
                <id>default-war</id>
                <phase>none</phase>
            </execution>
            <execution>
                <id>war-exploded</id>
                <phase>package</phase>
                <goals>
                    <goal>exploded</goal>
                </goals>
            </execution>
        </executions>

Solution

  • You can probably rely on Maven profiles (see introduction to Maven profiles) in order to configure the war plugin into an environment specific profile.