Yep, that works well. Since you want it to be available to all projects, the system properties are one way to do it.
On 1/17/06, Max Cooper <[EMAIL PROTECTED]> wrote: > Well, I am not sure this is a good answer, but I found something that > works -- save it in the systemScope: > > <preGoal name="build:start"> > <j:set var="svnRevision" > value="${systemScope.getProperty('my.svnRevision')}"/> > <j:if test="${svnRevision == null}"> > <ant:echo>Getting revision...</ant:echo> > <!-- code to get svn revision omitted --> > <j:set var="svnRevision" value="XXXXXX"/> > <!-- save in system scope --> > ${systemScope.setProperty('my.svnRevision', svnRevision)} > </j:if> > </preGoal> > > Comments are still welcome. :-) > > -Max > > On Mon, 2006-01-16 at 15:14 -0800, Max Cooper wrote: > > I want to initialize a variable or property just once at the beginning > > of a multiproject build and then be able to access that value in any of > > the subprojects. Ideally, running a subproject build on it's own would > > also initialize the value. > > > > For instance, so far I have something like this in my shared, > > common/maven.xml file: > > > > <preGoal name="build:start"> > > <j:if test="${svnRevision == null}"> > > <ant:echo>Getting revision...</ant:echo> > > <!-- code to get svn revision omitted, but I can post it if anyone > > is interested --> > > <j:set var="svnRevision" value="XXXXXX"/> > > </j:if> > > </preGoal> > > > > This doesn't work -- "Getting revision..." is echoed for each subproject > > build, which means that svnRevision isn't set in the context of each of > > the individual builds. I don't actually think this code should work (it > > makes sense that each subproject *would* have it's own independent > > instance of the svnRevision variable) -- I am just looking for tips > > about what I might change to get it to work. I just don't know where I > > can "stash" the value so that it will be available in the subproject > > builds. > > > > Thanks, > > -Max > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- http://www.multitask.com.au/people/dion/ "In order to succeed, your desire for success should be greater than your fear of failure." - Bill Cosby --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]