Pregunta

I'm using multimodule Maven project. Some modules are simply JARs but some of them are WARs (sometimes WAR is submodule of other submodule).

I those WAR modules I'm using tomcat plugin. For example:

        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>tomcat-maven-plugin</artifactId>
            <version>1.1</version>
            <configuration>
                <server>my_local_tomcat</server>
                <path>/registration</path>
                <url>http://localhost:8080/manager/text</url>
            </configuration>
        </plugin>

Now I must go to the root, then execute mvn clean install, then go into submodules containing WARs and execute mvn tomcat:redeploy for each one.

Can it be done from the root module to force Maven to find WARs and redeploy them?

¿Fue útil?

Solución

In each module you want to deploy, add a tomcat-deploy profile

  <profiles>
<profile>
  <id>tomcat-deploy</id>
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.tomcat.maven</groupId>
        <artifactId>tomcat7-maven-plugin</artifactId>
        <configuration>
          <server>my_local_tomcat</server>
          <path>/registration</path>
          <url>http://localhost:8080/manager/text</url>
        </configuration>
        <executions>
          <execution>
            <id>deploy-war</id>
            <phase>install</phase>
            <goals>
              <goal>deploy-only</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</profile>

Now run: mvn install -Ptomcat-deploy

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top