我希望在运行mvn install时,可以在/ target中生成war,在c:.... tomcat 6 \ deploy目录中生成另一个war。 我正在使用maven2,Eclipse和m2eclipse。这该怎么做 ?? Thnx:)
答案 0 :(得分:1)
如果您尝试Maven Jetty Plugin,也许您不需要复制war文件。此插件用于直接从Maven运行Web应用程序。
答案 1 :(得分:1)
您可以尝试使用maven-antrun-plugin将您的战争复制到tomcat部署目录,如下所示:
<build>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<phase>install</phase>
<configuration>
<target>
<copy file="{project.build.directory}/${project.actifactId}-${project.version}.war" tofile="<your tomcat path>/${project.actifactId}-${project.version}.war" />
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
答案 2 :(得分:1)
试试cargo-maven2-plugin。可能这样的事情会起作用:
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<executions>
<execution>
<id>deploy-local</id>
<phase>install</phase>
<goals>
<goal>deployer-deploy</goal>
<goals>
</execution>
</executions>
<configuration>
<container>
<containerId>tomcat6x</containerId>
</container>
<configuration>
<type>existing</type>
<home>/your/tomcat/dir</home> <!-- replace as needed -->
</configuration>
</configuration>
</plugin>
...将其打入配置文件或顶级<build><plugins>
部分,看看它是否适合您......