简体   繁体   中英

deploy multi-module maven project to Tomcat from IDE

I have a mutil-module Maven project wherein the pom's have the following packaging types

pom
 |--jar
 |--jar
 |--war

The war project depends on jar projects. I imagine this is a pretty typical setup for a webapp built with Maven. I can deploy and debug the project by

  • running mvn install
  • copying the war to Tomcat
  • starting Tomcat in debug mode
  • from the IDE, connecting the remote debugger to Tomcat

Obviously, performing these steps after every change, quickly becomes a pain. Is there a simpler way to build and deploy the project to Tomcat, such that it can be debugged from the IDE? Instructions for either Eclipse or IntelliJ (ideally both), would be welcome.

In case it makes any difference, I normally create the Eclipse project files using the m2eclipse plugin. In intelliJ I use the import maven project feature.

Thanks.

If you install the m2eclipse-extras (wtp support) you will be able to configure tomcat server within eclipse and deploy the applications from within eclipse. This will also watch the project for changes and automatically redeploy. This might not work well if it is a large application.

The other approach is to use the maven jetty plugin or the maven tomcat plugin that runs it as a web-app without requiring to build a war.

You can also look at jrebel (a commercial tool) that can load the changes to class files / cofiguration without requiring a redeployment.

m2e is between maven and eclipse (Tomcat is not involved here). Choose "Build Automatically" (make sure there is nothing under "Problems" tab. If it is,just delete the errors entry from "Problems" tab). This will compiler and convert everything to .class files.

wtp is between eclipse and tomcat (servers in general) for deployment.

m2e-wtp is like a bridge used for deployment of maven projects in tomcat

tomcat:run-war-only怎么样?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM