使用Maven将多个WARS部署到Tomcat中

时间:2014-12-08 10:19:20

标签: maven

我有两个应用程序,并希望使用maven将这两个WARS部署到tomcat 7.0中。我试图查看Stackoverflow的所有帖子,并相应地建模我的POM。但是,在运行父POM时,我注意到只部署了第一个应用程序(RestApp)而不是第二个应用程序。你能否看看POM中是否需要修正

父POM

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org    /2001/XMLSchema-     instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>my.parent</groupId>
<artifactId>ParentProj</artifactId>
<packaging>pom</packaging>
<version>1.0</version>
<name>Parent Maven Webapp</name>
<!-- <url>http://maven.apache.org</url> -->
<properties>

    <!--Test -->
    <project.build.finalName>ParentProj</project.build.finalName>
</properties>

<modules>
    <module>RESTApp</module>
    <module>WebIntegrationApp</module>
</modules>

<dependencies>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.8.2</version>
        <scope>test</scope>
    </dependency>


</dependencies>

<build>
    <finalName>${project.build.finalName}</finalName>
    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
            </plugin>
            <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-resources-plugin</artifactId>
                 <version>2.6</version>
            </plugin>
             <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                  <version>2.4</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-clean-plugin</artifactId>
                <version>2.5</version>
            </plugin>
            <plugin>
                <groupId>org.codehaus.cargo</groupId>
                <artifactId>cargo-maven2-plugin</artifactId>
                <version>1.1.3</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.16</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
                <version>2.16</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.4</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.tomcat.maven</groupId>
                <artifactId>tomcat7-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>deploy</id>
                        <phase>pre-integration-test</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                </executions>

                <configuration>
                    <warSourceDirectory>WebContent</warSourceDirectory>
                </configuration>
            </plugin>
        </plugins>
    </pluginManagement>

</build>

</project>

这是儿童应用

RestApp

   <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org     /2001/XMLSchema-     instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-              v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
    <groupId>my.parent</groupId>
    <artifactId>ParentProj</artifactId>
    <version>1.0</version>
    <relativePath>../</relativePath>
</parent>
    <artifactId>RestApp</artifactId>
<version>1.0</version>
<packaging>war</packaging>

  <properties>

    <!--Test -->
    <project.build.finalName>RestApp</project.build.finalName>
</properties>

<dependencies>


</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.mortbay.jetty</groupId>
            <artifactId>maven-jetty-plugin</artifactId>
            <version>6.1.25</version>
        </plugin>


        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
        </plugin>
    </plugins>
</build>

   WebIntegrationApp

  <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-    instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-    4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
    <groupId>my.parent</groupId>
    <artifactId>ParentProj</artifactId>
    <version>1.0</version>
    <relativePath>../</relativePath>
</parent>
<artifactId>WebIntegrationApp</artifactId>
<version>1.0</version>
<packaging>war</packaging>
<properties>

    <!--Test -->
    <project.build.finalName>WebIntegrationApp</project.build.finalName>
</properties>

<dependencies>


</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.mortbay.jetty</groupId>
            <artifactId>maven-jetty-plugin</artifactId>
            <version>6.1.25</version>
        </plugin>


        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <configuration>
                <webappDirectory>${project.build.directory}/tmp</webappDirectory>
            </configuration>
        </plugin>
    </plugins>
</build>

0 个答案:

没有答案