I'm on Windows XP, using Eclipse Indigo, Tomcat 6.0.33, and have the Maven plugin installed. (Using Maven 3.0.3 on my system). I have Tomcat showing up in my Eclipse servers list, but I can't figure out a one click way to deploy my WAR project to the Tomcat server. When I right click my project and select "Run" there are many Maven options (e.g. "Maven Install"), but none builds and then deploys my project to Tomcat.
Any help along these lines? Thanks, - Dave
First of all, select the project and go to “Run As -> Maven Build”. The “Edit Configuration” popup window will open. Enter the “Goals” as “package” to build the project and click on the Run button.
Go to the project in the Project Explorer, select the web project, right click and select "Run As", you will see Apache Tomcat, create runtime configuration for the web project by selecting "New" button.
see below link for details
http://mojo.codehaus.org/tomcat-maven-plugin/deployment.html
Alternatively, search for tomcat:run and you can use it directly
EDIT:
Run/Debug Configurations
Double click maven build, a new configuration will be created
put ${project_loc} for base directory
put tomcat:run for goals
give an appropriate name for yourself at the top
Apply and run/debug using your new configuration
EDIT2:
The link has been changed to below one: http://tomcat.apache.org/maven-plugin-trunk/tomcat7-maven-plugin/ (Thanks @Lucky)
within Eclipse, you can run the project by doing the following:
In the servers view, create a server (right-click, new Server, Tomcat) Add the project to the server (right-click the server, add & remove, select the project) Start the server - the server will start & deploy the app
The trick to this is that the server does not deploy the packaged app in the tomcat webapps directory, it deploys an exploded version into a directory under the plug-ins directory of the eclipse installation.
To specifically do the maven packaging and deploy to the external tomcat istance (external to eclipse), use the tomcat-maven-plugin, as specified by fmucar
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With