You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Michael Owen <mi...@hotmail.com> on 2005/07/28 18:56:35 UTC

[M1] Loading version from file

Hi,

I want to set the <currentVersion> in project.xml in Maven 1.0.2 to load 
from a file. So far I have:

  	<currentVersion>${currentversion}</currentVersion>

If I then set currentversion to a value in a property file, it is set for 
pom.currentVersion. What I need is to be able to set the property by loading 
up the value from a file. I thought I could do this by doing this piece of 
jelly script before every goal:

	<loadfile property="currentversion" srcFile="${versionfile}" 
failonerror="false"/>

However, this doesn't work because I guess the project.xml file has already 
be loaded up etc. I therefore need to execute this as one of the first 
things Maven does, before loading up project.xml, properties etc. Anybody 
know how to do this, or any other ideas how loading from a file for the 
<currentVersion> property can be achieved?

Many thanks,

Mike



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


Re: [M1] Loading version from file

Posted by Michael Owen <mi...@hotmail.com>.
I'm using Anthill Pro and it produces a version.txt file with the version in 
which it created for the project. I want to use this version number for the 
<currentVersion> in project.xml.

Seems a useful thing to be able to do, so I guess something must of done it 
before. :)

Any help would be great?

Mike

<br><br><br>&gt;From: Brett Porter 
&lt;brett.porter@gmail.com&gt;<br>&gt;Reply-To: Brett Porter 
&lt;brett.porter@gmail.com&gt;<br>&gt;To: Maven Users List 
&lt;users@maven.apache.org&gt;<br>&gt;Subject: Re: [M1] Loading version from 
file<br>&gt;Date: Fri, 29 Jul 2005 02:59:22 +1000<br>&gt;<br>&gt;It's only 
possible from project.properties.<br>&gt;<br>&gt;But I have to ask... 
why?<br>&gt;<br>&gt;- Brett<br>&gt;<br>&gt;On 7/29/05, Michael Owen 
&lt;michaelowenuk@hotmail.com&gt; wrote:<br>&gt; &gt; Hi,<br>&gt; 
&gt;<br>&gt; &gt; I want to set the &lt;currentVersion&gt; in project.xml in 
Maven 1.0.2 to load<br>&gt; &gt; from a file. So far I have:<br>&gt; 
&gt;<br>&gt; &gt;         
&lt;currentVersion&gt;${currentversion}&lt;/currentVersion&gt;<br>&gt; 
&gt;<br>&gt; &gt; If I then set currentversion to a value in a property 
file, it is set for<br>&gt; &gt; pom.currentVersion. What I need is to be 
able to set the property by loading<br>&gt; &gt; up the value from a file. I 
thought I could do this by doing this piece of<br>&gt; &gt; jelly script 
before every goal:<br>&gt; &gt;<br>&gt; &gt;         &lt;loadfile 
property=&quot;currentversion&quot; 
srcFile=&quot;${versionfile}&quot;<br>&gt; &gt; 
failonerror=&quot;false&quot;/&gt;<br>&gt; &gt;<br>&gt; &gt; However, this 
doesn't work because I guess the project.xml file has already<br>&gt; &gt; 
be loaded up etc. I therefore need to execute this as one of the 
first<br>&gt; &gt; things Maven does, before loading up project.xml, 
properties etc. Anybody<br>&gt; &gt; know how to do this, or any other ideas 
how loading from a file for the<br>&gt; &gt; &lt;currentVersion&gt; property 
can be achieved?<br>&gt; &gt;<br>&gt; &gt; Many thanks,<br>&gt; &gt;<br>&gt; 
&gt; Mike<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt; 
---------------------------------------------------------------------<br>&gt; 
&gt; To unsubscribe, e-mail: users-unsubscribe@maven.apache.org<br>&gt; &gt; 
For additional commands, e-mail: users-help@maven.apache.org<br>&gt; 
&gt;<br>&gt; 
&gt;<br>&gt;<br>&gt;---------------------------------------------------------------------<br>&gt;To 
unsubscribe, e-mail: users-unsubscribe@maven.apache.org<br>&gt;For 
additional commands, e-mail: users-help@maven.apache.org<br>&gt;<br>



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


Re: [M1] Loading version from file

Posted by Brett Porter <br...@gmail.com>.
It's only possible from project.properties.

But I have to ask... why?

- Brett

On 7/29/05, Michael Owen <mi...@hotmail.com> wrote:
> Hi,
> 
> I want to set the <currentVersion> in project.xml in Maven 1.0.2 to load
> from a file. So far I have:
> 
>         <currentVersion>${currentversion}</currentVersion>
> 
> If I then set currentversion to a value in a property file, it is set for
> pom.currentVersion. What I need is to be able to set the property by loading
> up the value from a file. I thought I could do this by doing this piece of
> jelly script before every goal:
> 
>         <loadfile property="currentversion" srcFile="${versionfile}"
> failonerror="false"/>
> 
> However, this doesn't work because I guess the project.xml file has already
> be loaded up etc. I therefore need to execute this as one of the first
> things Maven does, before loading up project.xml, properties etc. Anybody
> know how to do this, or any other ideas how loading from a file for the
> <currentVersion> property can be achieved?
> 
> Many thanks,
> 
> Mike
> 
> 
> 
> ---------------------------------------------------------------------
> 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