Reputation: 11
I'm current building a fairly simple webapp using Spring Roo. It seems, however, that Spring apps by default deploy to "/{app name}", rather than "/" as the top level directory. That is, controllers are mapped by "/{app name}/person", rather than just "/person". After poking around considerably, I couldn't see where this would be fixed. Is it a setting somewhere?
Upvotes: 1
Views: 734
Reputation: 3753
The base path is defined by the application server, not the application itself. In the pom.xml, overwrite the following plugins:
maven-war-plugin - mvn package, mvn tomcat:run-war
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.2</version>
<configuration>
<warName>ROOT</warName>
<!-- exclude test files from war package -->
<packagingExcludes>src/test/**</packagingExcludes>
</configuration>
</plugin>
tomcat-maven-plugin - mvn tomcat:run
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>tomcat-maven-plugin</artifactId>
<version>1.1</version>
<configuration>
<path>/</path>
</configuration>
</plugin>
org.mortbay.jetty - mvn jetty:run
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>8.0.4.v20111024</version>
<configuration>
<webAppConfig>
<contextPath>/</contextPath>
</webAppConfig>
</configuration>
</plugin>
Upvotes: 2
Reputation: 3080
Assuming your Spring Roo application runs on Apache Tomcat, what you can do is to configure the Tomcat Root context.
You can do this in following ways.
More information can be found on the following link.
http://benhutchison.wordpress.com/2008/07/30/how-to-configure-tomcat-root-context/
Cheers!
Upvotes: 0