Deployment to tomcat from eclipse via M2eclipse and Maven

妖精的绣舞 提交于 2019-12-07 06:04:15

问题


I'm using M2E to create Maven archetype projects (in this case a simple web app) with the aim of using Maven to deploy to a remote tomcat server.

I've added the tomcat-maven-plugin to the POM.XML file, and it appears to be correct.

         <plugin>
           <groupId>org.codehaus.mojo</groupId>
           <artifactId>tomcat-maven-plugin</artifactId>
           <configuration>
                <server>localServer</server>
           </configuration>
         </plugin>

and when I type "mvn tomcat:deploy" into terminal it deploys successfully. So I know my settings.xml as well as my tomcat settings are in order.

Is it possible to deploy the application directly from Eclipse without having to go through the terminal. In other words is it possible to pass the command "mvn tomcat:deploy" from eclipse to maven?

Cheers


回答1:


You can run all maven goal directly from Eclipse Run Configurations http://mevenide.codehaus.org/mevenide-ui-eclipse/user-guide/run.html

Also you can configure Server View in Eclipse (WTP) and simply deploy (or auto deploy after file change) directly from eclipse (maven is not used in this process, he is only responsible for configure proper nature of your project - ex. war).

Maven Integration for Eclipse WTP (a.k.a m2e-wtp) aims at providing a tight integration between Maven Integration for Eclipse (a.k.a m2e) and the Eclipse Web Tools Project (WTP) .

m2e-wtp provides a set of m2e connectors used for the configuration of Java EE projects in WTP. It features :

Support for war projects : adds the Java and Dynamic Web Facets. Support war overlays and on-the-fly resource filtering

Read also this: Maven/Tomcat Projects In Eclipse Indigo/3.7



来源:https://stackoverflow.com/questions/9053793/deployment-to-tomcat-from-eclipse-via-m2eclipse-and-maven

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!