4

Inside Eclipse with m2 Maven plugin installed. I can run my webapp in Tomcat via Eclipse WTP using "Run on Server" command.

Now I want to modify the context-path via Maven, so I use the following plugin:

<plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>tomcat-maven-plugin</artifactId>
        <version>1.1</version>
        <configuration>
          <path>${contextpath-name}</path>
        </configuration>
</plugin>

But then how do you exactly run this plugin inside Eclipse. Using Eclipse WTP always gives me the following URL - http://localhost:8080/myapp

I know I could run the plugin on a standalone Maven, but I want to know how to do it within Eclipse

Qantas 94 Heavy
  • 15,750
  • 31
  • 68
  • 83
chris
  • 3,820
  • 6
  • 36
  • 36

1 Answers1

10

Assumption

I am assuming that you have already installed the plugins for Maven for eclipse.

Installation

While selecting the project in project explorer select Run --> Run As --> Maven Install

Running Tomcat

Go to Run --> Run Configurations..

Add new Maven Build

Name the Process, Select the Base directory that will be deployed as war

set the Goal --> tomcat:run (this is a default goal for Tomcat)

By following the steps you can deploy every thing via Eclipse.

Have fun. :)

Talha Ahmed Khan
  • 15,043
  • 10
  • 42
  • 49