maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Max Cooper <...@maxcooper.com>
Subject Re: [m1.1-b-2] how can I initialize a variable/prop just once and share with subprojects in multiproject build?
Date Tue, 17 Jan 2006 00:48:04 GMT
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: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 


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


Mime
View raw message