How to Activate Maven Profile Inside Eclipse
Normally maven is use for project dependency management and lifecycle, so there are several developers working on it. Each has its own devel...
https://www.czetsuyatech.com/2011/11/maven-activate-maven-profile-on-eclipse.html
Normally maven is use for project dependency management and lifecycle, so there are several developers working on it. Each has its own development environment either in windows, linux or mac.
To do this we create several profiles for each developer in pom.xml.
If in case maven is not present, right click on project->Maven->Enable Maven Dependency 2.) Right click on project->Run As->Run Configurations->Maven Build->Add a new build (set profile and goal)
<profiles> <profile> <id>windows</id> <properties> <jboss.home>C:/manaty/jboss-4.2.3.GA</jboss.home> </properties> </profile> <profile> <id>linux</id> <properties> <jboss.home>/home/project/jboss-4.2.3.GA</jboss.home> </properties> </profile> </profiles>And then invoke mvn with the -P argument. Example:
mvn install -Pwindows mvn install -PlinuxHow could we do the same inside eclipse. There are 2 ways: 1.) Right click on the project->click properties->select maven menu
If in case maven is not present, right click on project->Maven->Enable Maven Dependency 2.) Right click on project->Run As->Run Configurations->Maven Build->Add a new build (set profile and goal)
2 comments
What's the reason of both ways fail?
I have threee profiles in my pom.xml...
When I add all the three profiles using project->properties->Maven-->Active Maven Profiles it ssems as if the last occurance of a profile element in the pom.xml is used.
Using the Runc Configurations the profile with
true
is used.
...the profile with
<activation>
<activeByDefault>true</activeByDefault>
</activation>
is used.
Post a Comment