Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Within Eclipse, how to run Tomcat Maven plugin that modifies the context path

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

like image 698
chris Avatar asked Dec 27 '22 21:12

chris


1 Answers

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. :)

like image 61
Talha Ahmed Khan Avatar answered Feb 09 '23 00:02

Talha Ahmed Khan