You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by John Taylor <jd...@roe.ac.uk> on 2005/01/09 13:59:52 UTC

Accessing properties in Maven that are set in Ant subbuilds?

Hi,
Does anyone know if it's possible to access properties defined in calls to 
Ant from Maven?  Ant seems to see Maven's properties perfectly well, but not 
vice versa

For example
in my maven.xml

<property name="mymaven.prop" value="hello"/>
<goal name="foo">
    <ant target = "bar" dir="." antfile="build.xml"/>
     <echo message="Ant property ${myant.prop}"/>
</goal>

and in the build.xml in the same directory:

<target name="bar">
    <echo>Maven property: ${mymaven.prop}</echo>
    <property name="myant.prop" value="world"/>
</target>

Only $mymaven.prop gets echoed.

I suspect this might actually be an Ant feature (properties in a master 
build are visible to sub-builds but not vice versa), but you never know - 
there might be some clever and Mavenish way to get round it.

John



=====================================
John Taylor
Astrogrid Java Developer
http://software.astrogrid.org
Royal Observatory of Edinburgh
+44 (0) 131 668 8329
skype id: johndavidtaylor
=====================================



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


Re: Accessing properties in Maven that are set in Ant subbuilds?

Posted by John Taylor <jd...@roe.ac.uk>.
Cheers Brett - that does the trick.
John
----- Original Message ----- 
From: "Brett Porter" <br...@gmail.com>
To: "Maven Users List" <us...@maven.apache.org>
Sent: Sunday, January 09, 2005 7:31 PM
Subject: Re: Accessing properties in Maven that are set in Ant subbuilds?


> not that I am aware of. I'd suggest creating a temporary properties
> file at the end of your ant build with the values you need, and
> reading that back in maven afterwards.
>
> - Brett
>
>
> On Sun, 9 Jan 2005 12:59:52 -0000, John Taylor <jd...@roe.ac.uk> wrote:
>> Hi,
>> Does anyone know if it's possible to access properties defined in calls 
>> to
>> Ant from Maven?  Ant seems to see Maven's properties perfectly well, but 
>> not
>> vice versa
>>
>> For example
>> in my maven.xml
>>
>> <property name="mymaven.prop" value="hello"/>
>> <goal name="foo">
>>     <ant target = "bar" dir="." antfile="build.xml"/>
>>      <echo message="Ant property ${myant.prop}"/>
>> </goal>
>>
>> and in the build.xml in the same directory:
>>
>> <target name="bar">
>>     <echo>Maven property: ${mymaven.prop}</echo>
>>     <property name="myant.prop" value="world"/>
>> </target>
>>
>> Only $mymaven.prop gets echoed.
>>
>> I suspect this might actually be an Ant feature (properties in a master
>> build are visible to sub-builds but not vice versa), but you never know -
>> there might be some clever and Mavenish way to get round it.
>>
>> John
>>
>> =====================================
>> John Taylor
>> Astrogrid Java Developer
>> http://software.astrogrid.org
>> Royal Observatory of Edinburgh
>> +44 (0) 131 668 8329
>> skype id: johndavidtaylor
>> =====================================
>>
>> ---------------------------------------------------------------------
>> 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
> 



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


Re: Accessing properties in Maven that are set in Ant subbuilds?

Posted by Brett Porter <br...@gmail.com>.
not that I am aware of. I'd suggest creating a temporary properties
file at the end of your ant build with the values you need, and
reading that back in maven afterwards.

- Brett


On Sun, 9 Jan 2005 12:59:52 -0000, John Taylor <jd...@roe.ac.uk> wrote:
> Hi,
> Does anyone know if it's possible to access properties defined in calls to
> Ant from Maven?  Ant seems to see Maven's properties perfectly well, but not
> vice versa
> 
> For example
> in my maven.xml
> 
> <property name="mymaven.prop" value="hello"/>
> <goal name="foo">
>     <ant target = "bar" dir="." antfile="build.xml"/>
>      <echo message="Ant property ${myant.prop}"/>
> </goal>
> 
> and in the build.xml in the same directory:
> 
> <target name="bar">
>     <echo>Maven property: ${mymaven.prop}</echo>
>     <property name="myant.prop" value="world"/>
> </target>
> 
> Only $mymaven.prop gets echoed.
> 
> I suspect this might actually be an Ant feature (properties in a master
> build are visible to sub-builds but not vice versa), but you never know -
> there might be some clever and Mavenish way to get round it.
> 
> John
> 
> =====================================
> John Taylor
> Astrogrid Java Developer
> http://software.astrogrid.org
> Royal Observatory of Edinburgh
> +44 (0) 131 668 8329
> skype id: johndavidtaylor
> =====================================
> 
> ---------------------------------------------------------------------
> 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