Are you running Windows? If you're running *nix, the quote syntax probably
won't work (shell dependant, of course). Try it with only one word, hello,
and no quotes.

-Dcommand.line.prop=hello

If that does not work, did you type the values into the file, and also into
the command line (rather than copy-and-paste)? I can't see why it wouldn't
work if you tried the above property argument, short of a character encoding
difference.

Eric

On 4/30/06, Sebastien Arbogast <[EMAIL PROTECTED]> wrote:

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


Reply via email to