3

I have maven project which contains two modules: jar and war. war-module depends on jar:

-pom
--jar
--war

Early I used org.codehaus.mojo tomcat-maven-plugin plugin to deploy my single war project by command:

mvn tomcat:deploy

But here this command doesn't work. How I can deploy war project in multi modules case?

Solution was found: How can I deploy multiple wars using the tomcat plugin in maven?

I added this in my child war project's pom.xml:

<plugin>
<groupId>org.codehaus.mojo</groupId>
    <artifactId>tomcat-maven-plugin</artifactId>
    <version>1.0-beta-1</version>
    <executions>
      <execution>
        <id>deploy</id>
        <phase>pre-integration-test</phase>
        <goals>
          <goal>deploy</goal>
        </goals>
      </execution>
    </executions>
  </plugin>

And on parent project I can run:

mvn package tomcat:deploy
Community
  • 1
  • 1
CHEM_Eugene
  • 438
  • 3
  • 20

1 Answers1

0

The best approach is to create a new module which contains the configuration for the tomcat-maven-plugin and may be (depending on your needs) it might be wise to create a separate profile for deployment in this case.

khmarbaise
  • 92,914
  • 28
  • 189
  • 235
  • I have parent pom.xml file. Can I place this configuration here? Could you write example of this configuration? – CHEM_Eugene Mar 01 '12 at 09:10
  • 1
    I can recommend to read the following: https://github.com/khmarbaise/maui/tree/master/src/main/resources/it-example-container (this contains a full example for integration testing). But it used cargo2-maven-plugin instead of the tomcat plugin. But you can use the cargo2-plugin as well to deploy to tomcat. If you prefer to stick with the maven-tomcat-plugin you can use the mod-it module and change the configuration appropriately. (Here is some description about it: http://khmarbaise.github.com/maui/it-example-container.html) – khmarbaise Mar 01 '12 at 09:45