You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by ga...@hotpop.com on 2005/01/03 14:59:37 UTC
Re: Weird behaviour from import in Ant 1.6.2
"Rhino" <rh...@sympatico.ca> writes:
> 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??
I don't know. It works for me on my box. Try hardcoding the fully
qualified path/filename for your datetime.xml file. Maybe something
with permissions is getting you?
--
Galen
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org