Publish to tomcat: run on Maven

I am considering using Maven 3 for my Spring projects that I have developed using Eclipse and Tomcat. Still;

  • I turned off "Republish Automatically" because sometimes I don't need to publish, I only save .java files (classes) and keep development in debug mode.
  • I republish (by clicking the Eclipse "publish" button in the Servers view) only when I have changed the js, jsp, or htm-like files and not the class files, so I can continue developing without restarting Tomcat.

Now I'm going to use Maven to debug / run while developing, but whenever I change my code I don't know how to "publish" issues to Maven as it doesn't use Eclipse Tomcat directly. I stop maven and start again. Do I have to do this for all changes in my code? How can I do this maven -tomcat: run- "publish / republish" for js / jsp / html files and "do nothing" for .java files?


source to share

3 answers

Unfortunately yes, you will need to start maven for every change.

Maven't really meant to be used this way - it assumes you are going to use maven when you are ready to build (i.e. after development), but use something like Eclipse if you are trying to see your changes in real time. It has no mechanism to listen for changes.

For my webapps, I use both maven and Eclipse, with m2e and Maven Integration plugins for Eclipse WTP. With this setup, I can see my changes in real time using the built-in Tomcat instance in Eclipse and when I'm done, I use maven to build.

Give these two plugins a shot - I think it will suit your needs.



I had the same problem. And this is because I ran maven eclipse: eclipse. The server will then stop publishing (click on the post and report it has been synced). I downloaded again .classpath and .project and other internal eclipse project structure files from cvs and the server starts publishing again. Maybe this can help.




For the benefit of Googlers:

I was getting errors NoClassDefFound

using tomcat:run

to start the application.

It took some googling, but the following are the notes on the post where the usage tomcat:run-war

allows your dependencies to get from the WAR:

However, to debug and replace hot code, the easiest way is to start Tomcat from the Servers view in Eclipse.



All Articles