如何在maven中使用tomcat插件部署多个wars

Ton*_*kuk 5 java deployment tomcat maven

从我关注的论坛中,我尝试了一些方法来找到在 Maven 中使用 tomcat 插件部署多重战争的方法,但我无法成功。

我创建了第三个项目并使用了三个项目来部署它们,但我还没有这样做。你能告诉我怎么做吗?

最好的问候阿尔珀·科普兹

这是我使用的 pom.xml :

<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>

<groupId>
tr.com.provus.pays
</groupId>
<artifactId>PAYSGroupProject</artifactId>
  <version>1.0</version>
  <packaging>pom</packaging>

  <modules>
    <module>../PAYSWeb</module>
    <module>../PAYSDashboard</module>
    <module>../PAYSStaticWeb</module>
  </modules>

  <name>PAYSGroupProject</name>
  <url>http://maven.apache.org</url>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>

  <build>
  <plugins>
    <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>
  </build>

</project>
Run Code Online (Sandbox Code Playgroud)

gma*_*gma 4

我猜你不能在 pom 类型的项目上使用 tomcat 插件,而是尝试将插件配置到一个 war 项目中,并将其他项目作为 webapp 依赖项包含在内,如下所示:

<configuration>
    <webapps>
      <webapp>
        <contextPath>/PAYSWeb</contextPath>
        <groupId>tr.com.provus.pays</groupId> 
        <artifactId>PAYSWeb</artifactId>
        <version>${project.version}</version>
        <type>war</type>    
        <asWebapp>true</asWebapp>
      </webapp>
      <webapp>...</webapp>
    </webapps> 
  </configuration>
Run Code Online (Sandbox Code Playgroud)

另请参阅这篇文章(但未答复)