| Author |
Message |
|
|
Post subject: Maven profile properties in pom.xml
Posted: Aug 09, 2010 - 04:57 AM
|
|
Veteran Member

Joined: Dec 01, 2008
Posts: 8
|
|
Hi, what is the easiest way to tell MyEclipse to use the profile properties from the pom.xml when I start the application server?
pom.xml:
| Code: |
...
<profiles>
<profile>
<id>dev</id>
<properties>
<foo>bar</foo>
...
</properties>
</profile>
</profiles>
...
|
At the moment it throws an error because a field in one of my properties relies on the pom.xml, which is not being populated.
properties file:
| Code: |
...
something=${foo}
...
|
In the past we used maven to run the project through a Jetty server rather than deploying and starting the app server through MyEclipse (which is preferred).
Any help would be greatly appreciated. |
|
|
| |
|
|
|
 |
|
|
Post subject: RE: Maven profile properties in pom.xml
Posted: Aug 12, 2010 - 08:35 AM
|
|
Registered Member


Joined: Feb 03, 2009
Posts: 3442
|
|
Akumadevil,
Add the maven-resources-plugin (please note that it is a maven-war plugin even in case it is a war)
Then add the following node in POM.xml
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.3</version>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
and also add the following node
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
The resources node will specify the resources directroy (i.e the property file which needs to be populated)
Create a profile and use this resource plugin to substitute the value in the property file.For details refer - http://www.manydesigns.com/documentation/tutorials/using-maven-profiles-and-resource-filtering.html |
_________________ Joy
MyEclipse Support
|
| |
|
|
|
 |
|
|
Post subject: RE: Maven profile properties in pom.xml
Posted: Aug 13, 2010 - 08:01 AM
|
|
Veteran Member

Joined: Dec 01, 2008
Posts: 8
|
|
Hi,
The example link relies on building the package through maven specifying the profile (e.g. "mvn package -P development").
I normally use the MyEclipse "Add Deployment" feature to build the webapp -- can I configure MyEclipse to automatically run the relevant maven command on deployment? |
|
|
| |
|
|
|
 |
|
|
Post subject: RE: Maven profile properties in pom.xml
Posted: May 04, 2011 - 02:09 PM
|
|
Registered Member


Joined: Dec 22, 2006
Posts: 6
|
|
Did you find out how to do it?
I have the exact same issue, I can run my profile through the command line but not via myeclipse.
I added my profile into my project preferences into the Maven4Myeclipse config. |
|
|
| |
|
|
|
 |
|
|
Post subject: RE: Maven profile properties in pom.xml
Posted: May 05, 2011 - 10:07 AM
|
|

Joined: Nov 11, 2010
Posts: 2191
|
|
|
_________________ Swapna
MyEclipse Support
|
| |
|
|
|
 |
|
|