I'm just going through "Better Builds With Maven" book and once again, I
can't help being amazed by the quality of it !
Nevertheless, there are a few small errata here and there and for I'm
tagging them as I'm reading so that I can provide feedback when I've them
all. But here I'm stuck on some more important issue: in page 49, just
before section 2.6.3, it's said that
Filtering resources can also retrieve values from system properties; either
the system properties built into Java (like java.version or user.home), or
properties defined on the command line using the standard Java -D parameter.
To continue the example, change the application.properties file to look like
the following:
# application.properties
java.version=${java.version}
command.line.prop=${command.line.prop}
Now, when you execute the following command (note the definition of the
command.line.prop property on the command line), the
application.propertiesfile will contain the values from the system
properties.
mvn process-resources "-Dcommand.line.prop=hello again"
Unfortunately, here is what I get in my generated application.propertiesfile:
# application.properties
java.version=1.0-SNAPSHOT
command.line.prop=${command.line.prop}
So the problem is that:
- system property java.version is actually replaced by my project's version
- command.line.prop is not taken into account on the command line.
I tried a different syntax, putting the double quotes around "hello again"
only, but it didn't work either.
Has anyone got an idea of what I may have done wrong ?
--
Sébastien Arbogast
The Epseelon Project : http://www.epseelon.net
Blog : http://sebastien-arbogast.epseelon.net
TagSpot : http://www.tagspot.org