I'm using the Maven2 and Tomcat plugins for eclipse for a java project that gets deployed as a Tomcat app. I have several Run Configurations for a different goals, but I have one in particular that does multiple goals in sequence:
clean resources:resources compile war:war tomcat:deploy
I wanted one of my resource xml files to have config values specific to the build, for instance a dev-build versus a production-build. The resources:resources
step should allow me to set values to {tags} in the xml, and I am able to do this via the command line as it's own step:
<test var="{foo}">
Running mvn resources:resources -Dfoo='bar'
produces the following in the target directory
<test var="bar">
In the Run Configuration management gui in eclipse, there are slots for arguments and values, but I can't find the correct combination/incantation of parameters to get the same effect as the command line evocation.
Anyone know how? Of course, would also accept "You're doing it wrong," (because I probably am) " Do it like this."
Thanks!
You can pass in parameters that are eventually used as Maven properties, using the parameters section of a Maven Build run configuration in Eclipse (I'll assume that you're using the Eclipse M2E plugin).
The following screenshot demonstrates how the {jacoco.agent.path}
property that I eventually used in my Maven POM, is specified from the run configuration:
If you go to Run Configurations > Apache Tomcat > [your tomcat] > Arguments Tab > VM Arguments And add -Dfoo="bar", it should work.
I had to stop and start and clean a few times before it picked it up, but it worked for me eventually.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With