Search code examples
eclipsetomcatmaven-3m2eclipse

Deployment to tomcat from eclipse via M2eclipse and Maven


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


Solution

  • 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