Is there an easy way to specify an alternate port for Tomcat in the pom or on the commandline. I'd like to have several projects running on the same machine.
+2
A:
If you are using the maven tomcat plugin, you can specify a context.xml by adding a plugin configuration block to the pom.xml:
<project>
...
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>tomcat-maven-plugin</artifactId>
<version>1.0-beta-1</version>
<configuration>
<mode>both</mode>
</configuration>
</plugin>
</plugins>
</build>
...
</project>
The default context.xml file used is located at src/main/webapp/META-INF/context.xml
.
Set different ports there.
Pascal Thivent
2009-03-14 21:12:34
+1
A:
Using the syntax given on http://mojo.codehaus.org/tomcat-maven-plugin/run-mojo.html, you can directly specify the port:
<plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>tomcat-maven-plugin</artifactId> <configuration> <server>tomcat-development-server</server> <port>9966</port> </configuration> </plugin>
Greg
2010-04-09 15:06:12
Can this be specified within the settings.xml? This configuration would break others using it if their tomcat ran on a different port.
Drew
2010-08-12 15:28:48