You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Cezariusz Marek <ce...@comarch.pl> on 2011/12/05 23:44:21 UTC

Default value of an environment variable

Hello!

I have a multimodule project, which is being build both from the command line (or Eclipse
plugin) and by Jenkins server.

When building by Jenkins, I use the SVN_REVISION environment variable, to set the name of
the final executable (and also the revision number in the About dialog).

When building from the command line, the SVN_REVISION variable is not defined, and I
don't care about the name of the executable, because it's used only by developers. Also,
I don't want to force all the developers (there are many of them in different branch
offices) to define this variable. I'd like to define a default value for this variable
somewhere in pom.xml.

Any clues how to do it? I've tried to define this variable in <properties> section,
hoping it won't get overriden when defined, like variables defined with -D option, but's
that's not the case with environment variables.

So when I write like this:

	<properties>
		<version.revision>${env.SVN_REVISION}</version.revision>
	</properties>

the build fails, because it expects version.revision to be a number.

When I write like this:

	<properties>
		<env.SVN_REVISION>999</env.SVN_REVISION>
		<version.revision>${env.SVN_REVISION}</version.revision>
	</properties>

the value of the version.revision is allways 999, even if SVN_REVISION is defined (by
"set SVN_REVISION=123" on Windows).

-- 
____________________________________________________________________
Cezariusz Marek                   mob: +48 608 646 494
http://www.comarch.com/           tel: +48 33 815 0734
____________________________________________________________________



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org