Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

configure eclipse, tomcat and maven to improve productivity in webapp

(Am a maven noob)

Have a maven built webapp which uses spring, etc.

  1. When I run "mvn clean install", it generates a .war file in the target directory.
  2. I copy the .WAR file to tomcat for deploying the app.
  3. Debug the app
  4. Edit the code

This process takes a lot of time. When I earlier used ant, I would point tomcat's server.xml to my webapps directory. Also, Eclipse would put all of its classfiles in my webapp\WEB-INF\classes folder. If I had to modify any JSPs, I would just edit and there was no need of additional copying. If I modified a .java file, Eclipse would build it and put the .class file in the WEB-INF\classes folder so that Tomcat would pick it up.

Now, each time I make changes to a .jsp, I need to manually copy the .jsp to tomcat's webapps directory. Isn't there a way that a maven built app can optimize this process ?

So, where do you point your tomcat at that makes development productive?

project (where pom.xml resides)
  src
    main
     java
     resources
     webapp
       WEB-INF
  target
    webapp
    webapp.war

Basically, I would like to know how to configure eclipse(3.7.1) and tomcat/maven so that the edit/deploy/debug cycle is really fast.

UPDATE1

1) I was able to get m2e(http://download.eclipse.org/technology/m2e/releases/) installed in indigo(v. 3.7.1 of eclipse). it had 2 components a) maven integration for eclipse b) slf4j logging

It installed successfully asking me to restart eclipse. I restarted.

2) Next, I installed m2e-wtp (at http://download.jboss.org/jbosstools/updates/m2eclipse-wtp/) It had 3 components a) maven integration for eclipse b) maven integration for eclipse Extras c) maven integration for WTP.

When I selected all 3, I got some error. So, I unselected the 1st two and only selected the 3rd one and then it installed successfully asking me to restart eclipse. I restarted.

@Raghuram I ran the 4 steps that you suggested below. Only the 4th step resulted in an error and my webapp could not get deployed. It resulted in an error "File not found --- .svn/.wcprops/.

https://i.sstatic.net/HfZxm.png

What should I make of it ?

Thanks again,

like image 274
anjanb Avatar asked Dec 04 '25 02:12

anjanb


1 Answers

I'd recommend you to use cargo to deploy automatically to a local container (that can be downloaded and started) Maven+Cargo

Then having that started with jpa activated (so that you can remotly debug your code) you just have to attach a listener and debug from eclipse, intellij, whatever.

For JSP, talking Intellij, you must tell your IDE where to package files (right-click 'package file") which is done in the project setup (output classes dir in WEB-INF/classes)

Check Tomcat 7 - Maven Plugin? for an example cargo configuration for Tomcat 7. After the confiuration is valid you can deploy to your Container using mvn cargo:deploy and mvn cargo:redeploy

like image 96
Andy Petrella Avatar answered Dec 05 '25 16:12

Andy Petrella



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!