mvn tomcat7-maven-plugin:run -am -pl :foo
を使用して、一度に1つのプロジェクトだけをTomcat like is shown hereで実行しました。今は、複数のモジュールを同じポートで実行したいが、異なるコンテキストを使用したい。例えば、私が持っているしたいと思います:mavenプラグインの使い方tomcat7:複数のコンテキスト(WAR)で実行しますか?
/ => foo.war
/bar => bar.war
は、ここで例のpom.xmlは、私が取り組んできたことをスニペットです:
<project><!-- ... -->
<build><!-- ... -->
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.0-SNAPSHOT</version>
<configuration>
<path>/</path>
<port>8080</port>
<addContextWarDependencies>true</addContextWarDependencies>
<addWarDependenciesInClassloader>true</addWarDependenciesInClassloader>
<warSourceDirectory>${project.build.directory}/${project.build.finalName}/</warSourceDirectory>
</configuration>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>bar</artifactId>
<version>${project.version}</version>
<type>war</type>
<scope>tomcat</scope>
</dependency>
</dependencies>
</plugin>
</plugins>
</pluginManagement>
</build>
<pluginRepositories>
<pluginRepository>
<id>apache.snapshots</id>
<name>Apache Snapshots</name>
<url>http://repository.apache.org/content/groups/snapshots-group/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</project>
はtomcat7-maven-plugin:run
プラグインで、このことは可能ですか?私はそれがうまくいくために正しい構文を見つけるのに苦労しています。 maven
コマンドを実行すると、プロジェクト階層で最初に検出されたコマンドだけが実行されます。そして、私が<fork>true</fork>
でそれらを実行するか、明らかに異なる端末から実行すると、 "java.net.BindException:Address already in use:8080"が表示されます。
私は、現在のモジュール内でルートとして実行されているコンテキストを定義するconfigのチャンクであると仮定していますか?すなわち、私の "bar.war"を "/ bar"として "foo.war"のpom.xmlに "/"として追加する方法でしょうか?依存関係のために直接動作しませんでしたが、私はまだそれを試しています。 – mckamey
"bar.war"の依存関係を処理することはできません。私は明示的にこれをhttp://stackoverflow.com/a/9928987/43217のように追加しようとしましたが、運はありません。 – mckamey
また、スコープ "tomcat"の依存関係として "bar.war"をモジュール自体に追加しようとすると、最初にビルドされ、tomcat7:runコマンドが代わりに実行しようとします。 – mckamey