I've been using mvn tomcat7-maven-plugin:run -am -pl :foo
successfully to run just a single project at a time in Tomcat like is shown here. Now I'd like to have multiple modules run under the same port but different contexts. For instance, I'd like to have:
/ => foo.war
/bar => bar.war
Here's an example pom.xml snippet that I've been working with:
<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>
Is this possible with the tomcat7-maven-plugin:run
plugin? I'm struggling to find the correct syntax to get it to play well. When I run the maven
command to run it, it only runs the first one it finds in the project hierarchy. And if I run them with the <fork>true</fork>
or obviously from different terminals then I get "java.net.BindException: Address already in use :8080".