MyEclipse Forums
Post new topic   This topic is locked: you cannot edit posts or make replies.
View previous topic Printable version Log in to check your private messages View next topic
Author Message
Akumadevil
Post subject: Maven profile properties in pom.xml  PostPosted: Aug 09, 2010 - 04:57 AM
Veteran Member
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.
 
 View user's profile Send private message  
Reply with quote Back to top
support-joy
Post subject: RE: Maven profile properties in pom.xml  PostPosted: Aug 12, 2010 - 08:35 AM
Registered Member
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
 
 View user's profile Send private message  
Reply with quote Back to top
Akumadevil
Post subject: RE: Maven profile properties in pom.xml  PostPosted: Aug 13, 2010 - 08:01 AM
Veteran Member
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?
 
 View user's profile Send private message  
Reply with quote Back to top
deeeed
Post subject: RE: Maven profile properties in pom.xml  PostPosted: May 04, 2011 - 02:09 PM
Registered Member
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.
 
 View user's profile Send private message  
Reply with quote Back to top
support-swapna
Post subject: RE: Maven profile properties in pom.xml  PostPosted: May 05, 2011 - 10:07 AM



Joined: Nov 11, 2010
Posts: 2191

deeeed,

Your query is answered here. Please follow it up :
http://myeclipseide.com/index.php?name=PNphpBB2&file=viewtopic&p=122857

_________________
Swapna
MyEclipse Support
 
 View user's profile Send private message  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT - 6 Hours
Post new topic   This topic is locked: you cannot edit posts or make replies.
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2004 The PNphpBB Group
Credits