Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven Profiles and Tomcat in Eclipse

If I have 2 maven profiles for a WAR application like this:

mvn clean install -Pdevelopment
mvn clean install -Pproduction

and I import it in Eclipse to run in Tomcat, how to I tell Tomcat to use one profile or the other?

like image 358
cahen Avatar asked Apr 29 '13 14:04

cahen


People also ask

How do I run a Maven project from Tomcat in Eclipse?

Right-click the maven project, click Run As —> Run Configurations menu item. Input clean install tomcat7:deploy in the Goals input text box deploy maven project to tomcat. Click Run button, when you see BUILD SUCCESS in the output console, that means the maven deploy to tomcat server process complete successfully.

Where are profiles configured in Maven?

Profiles are specified in pom. xml file using its activeProfiles/profiles elements and are triggered in variety of ways.

What is Mvn profile?

A profile in Maven is an alternative set of configuration values which set or override default values. Using a profile, you can customize a build for different environments.


1 Answers

You can activate the maven profile at the Eclipse by using the following step: -

  1. Right click at your project and select properties .
  2. At the Properties windows select Maven.
  3. At the right hand panel you will see Active Maven Profiles text box.
  4. Please enter your profile name, e.g. development or production.

I hope this may help.

like image 65
Charlee Chitsuk Avatar answered Oct 21 '22 05:10

Charlee Chitsuk