ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From galenboyer...@hotpop.com
Subject Re: Weird behaviour from import in Ant 1.6.2
Date Mon, 03 Jan 2005 14:08:22 GMT
"Rhino" <rhino1@sympatico.ca> writes:

    > 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.

Well, there ya go for my previous post.

    > 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"/-->

Okay, 

I tried this with 1.6.1 and got the same behaviour.  1.6.1 seemingly
has a bug with ant.home being used that way?  But with 1.6.2, ant.home
works as you are looking for (at least on my box).  Have you tried
this making sure 1.6.2 is the version of ant you are using?

    > <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??


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


Mime
View raw message