ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rhino" <rhi...@sympatico.ca>
Subject Re: Weird behaviour from import in Ant 1.6.2
Date Fri, 31 Dec 2004 00:16:17 GMT
Just to follow up on this question, I've now managed to make my imports work
by removing ${ant.home} and replacing it with the actual value of ant.home.

This is my revised build.xml:

<?xml version="1.0" ?>

<project name="SDAC" default="buildall"
basedir="E:\eclipse\3.0.1\eclipse\workspace">

<description>Create the SDAC jars.

</description>

<!--==================================================================

Import common code.

==================================================================-->

<!--property name="import.path" value="${ant.home}\imports"/-->

<property name="import.path"
value="e:\eclipse\3.0.1\eclipse\plugins\org.apache.ant_1.6.2\imports"/>

<!--property name="import.path" value="d:\Ant\apache-ant-1.6.1\imports"/-->

<import file="${import.path}\sounds.xml" description="Play appropriate
sounds depending on whether build worked or failed."/>

<import file="${import.path}\datetime.xml" description="Display date and
time that build started."/>

<target name="go">

<echoproperties prefix="ant"/>

</target>

<!--==================================================================

Do the complete build.

==================================================================-->

<target name="buildall" depends="datetime,go" description="Tasks that should
always be run upon completion of the build.">

<echo message="The SDAC jars have been generated."/>

</target>

</project>


All I did was to modify the value of the 'import.path' property. I'm still
baffled why I need to do that; it seems to me that ${ant.home} SHOULD work
in the original version of 'import.path'. Can anyone tell me why it doesn't
work? I'd still like to get it working with ant.home if I can.....

Rhino



----- Original Message ----- 
From: "Rhino" <rhino1@sympatico.ca>
To: "ant-user" <user@ant.apache.org>
Sent: Thursday, December 30, 2004 6:43 PM
Subject: Weird behaviour from import in Ant 1.6.2


> I am getting some weird behaviour from Ant 1.6.2 in Eclipse 3.0.1.
>
> A while ago, I created a couple of simple imported tasks to do some basic
> work for me. My plan was to import these tasks into each Ant script that I
> write. Initially, this worked but I've been away from Ant for a few months
> and now I find that it doesn't work any more.
>
> Basically, the problem is that Ant isn't seeing my imported scripts any
> more. Whenever I edit my build.xml, I get this message: Cannot find
> ${ant.home}\imports\datetime.xml imported from
> E:\eclipse\3.0.1\eclipse\workspace\SDAC\xml\build.xml. (A comparable
message
> occurs for the other imported script, sounds.xml, so I've just commented
it
> out and assume it is having the same problem that 'datetime.xml' is
having.)
> Here is the build.xml:
>
> <?xml version="1.0" ?>
>
> <project name="SDAC" default="buildall"
> basedir="E:\eclipse\3.0.1\eclipse\workspace">
>
> <description>Create the SDAC jars.
>
> </description>
>
> <!--==================================================================
>
> Import common code.
>
> ==================================================================-->
>
> <property name="import.path" value="${ant.home}\imports"/>
>
> <!--import file="${import.path}\sounds.xml" description="Play appropriate
> sounds depending on whether build worked or failed."/-->
>
> <import file="${import.path}\datetime.xml" description="Display date and
> time that build started."/>
>
> <target name="go">
>
> <echoproperties prefix="ant"/>
>
> </target>
>
> <!--==================================================================
>
> Do the complete build.
>
> ==================================================================-->
>
> <target name="buildall" depends="go" description="Tasks that should always
> be run upon completion of the build.">
>
> <echo message="The SDAC jars have been generated."/>
>
> </target>
>
> </project>
>
>
> The datetime.xml file contains the following:
>
> <?xml version="1.0" ?>
> <project name="Datetime" default="datetime" basedir=".">
> <description>This fragment will be imported into every Ant build
> script that needs to display the time and date that the build began.
> </description>
>
> <target name="datetime" description="Display date and time that build
> began.">
>  <tstamp prefix="start">
>   <format property="TODAY" pattern="EEEE, MMM dd, yyyy"/>
>   <format property="TIME" pattern="hh:mm a"/>
>   </tstamp>
>  <echo message="This Ant script began executing at ${start.TIME} on
> ${start.TODAY}."/>
> </target>
>
> </project>
>
> When I run my build.xml, it confirms that ant.home is
> E\:\\eclipse\\3.0.1\\eclipse\\plugins\\org.apache.ant_1.6.2. I am
absolutely
> certain that ant.home contains an 'imports' directory and that 'imports'
> contains a file called 'datetime.xml'. However, the 'datetime.xml' file is
> not visible to the Ant Editor and the task within 'datetime.xml' is not
> executed when I run the build.
>
> I also have a copy of Ant 1.6.1 installed outside of Eclipse and it also
has
> an 'imports' directory beneath it and a 'datetime.xml' within the
'imports'
> directory; when I run a build.xml from the command line outside of
Eclipse,
> it also fails to run the task within 'datetime.xml', presumably because
Ant
> doesn't see it.
>
> What am I doing wrong??
>
> Rhino
> ---
> rhino1 AT sympatico DOT ca
> "There are two ways of constructing a software design. One way is to make
it
> so simple that there are obviously no deficiencies. And the other way is
to
> make it so complicated that there are no obvious deficiencies." - C.A.R.
> Hoare
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message