- This topic has 4 replies, 4 voices, and was last updated 13 years, 6 months ago by support-swapna.
-
AuthorPosts
-
AkumadevilMemberHi, 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:
... <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:
... 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.
support-joyMemberAkumadevil,
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
AkumadevilMemberHi,
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?
deeeedMemberDid 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.
support-swapnaModeratordeeeed,
Your query is answered here. Please follow it up :
https://www.genuitec.com/forums/topic/how-to-run-profiles-within-pom-in-myeclipse/#post-316562 -
AuthorPosts