2

Is it possible to have the maven war plugin output to two different locations? I currently have the following in my pom.

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-war-plugin</artifactId>
    <version>2.1.1</version>
    <executions>
      <execution>
        <phase>compile</phase>
        <goals>
          <goal>exploded</goal>
        </goals>
      </execution>
    </executions>
    <configuration>
      <webappDirectory>${webappDirectory}</webappDirectory>
    </configuration>
</plugin>

This was already existing in the POM for the gwt maven archetype, and I'm guessing this explodes everything into the webappDirectory(which the gwt plugin then uses for it development mode).

When I do a

mvn war:war

It generate a war file for me in the target directory. So, I suspect its a different plugin configuration than the one in my POM (default behaviour?). How do I override this?

I basically want to accomplish the following:

I would like to have two different resource folders "src/resources/a" and "src/resources/b" , and have one of the folders used in the exploded version (currently in my pom) and the other version used when I do a "mvn war:war"

JustDanyul
  • 13,813
  • 7
  • 53
  • 71

1 Answers1

3

Per this question How to execute maven plugin execution directly from command line?, Maven doesn't use pom configuration when you invoke a plugin directly (e.g. mvn war:war). Your POM config is telling Maven to run the exploded goal when the compile phase is invoked (i.e when you run mvn [phase] where phase is compile or later).

I suggest you investigate using a separate profile for exploded deployment (called eg exploded), with a different configuration of the resources plugin to copy a different resources directory. Then use mvn compile -Pexploded for the exploded version.

Community
  • 1
  • 1
artbristol
  • 32,010
  • 5
  • 70
  • 103