ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Levy" <dav...@thedistillery.com.au>
Subject RE: subant to reference a task outside of build.xml?
Date Wed, 23 Mar 2005 04:02:40 GMT
I think there are a few problems you may be facing. From the looks of it,
you're importing the file "properties.xml" when you should be importing
"package.xml". If "properties.xml" is a properties file, it should be
brought in to the script via a property taskdef:

<property file="properties.xml"/>

The other issue you have is your attempt to call the target on the other
build script. This will not work unless you are importing the package.xml
properly and not property.xml. Once that gets fixed up, you need to do a few
things:

1.) First, fix up the package.xml so that it has an actual project around
it, like this:
<project name="package_import" default="package">
<target name="package">
  <jar jarfile="${outputDir}/${mainClass}.jar" basedir="${outputDir}" >
    <manifest>
      <attribute name="Main-Class" value="${pkgPath}${mainClass}"/>
    </manifest>
  </jar>
</target>
</project>


2.) Change the antcall so that it instead calls the target,
"package_import.package" rather then the naked "package".

Try that and your build script should be a bit more healthy.

-----Original Message-----
From: THUFIR HAWAT [mailto:hawat.thufir@gmail.com]
Sent: Sunday, 20 March 2005 9:41 PM
To: Ant Users List
Subject: subant to reference a task outside of build.xml?

data:

D:\>
D:\>
D:\>ant
Buildfile: build.xml

clean:
   [delete] Deleting directory D:\java\classes

prepare:
    [mkdir] Created dir: D:\java\classes

compile:
    [javac] Compiling 3 source files to D:\java\classes

package:
     [echo] mainClass=HelloWorldSwing

clean:
   [delete] Deleting directory D:\java\classes

prepare:
    [mkdir] Created dir: D:\java\classes

compile:
    [javac] Compiling 3 source files to D:\java\classes

package:
     [echo] mainClass=HelloWorldSwing

BUILD FAILED
D:\build.xml:23: The following error occurred while executing this line:
D:\build.xml:23: antcall task calling its own parent target.

Total time: 5 seconds
D:\>type package.xml
<target name="package">
        <jar jarfile="${outputDir}/${mainClass}.jar" basedir="${outputDir}"
>
                <manifest>
                        <attribute name="Main-Class"
value="${pkgPath}${mainClass}"/>
                </manifest>
        </jar>
</target>

D:\>type build.xml
<project name="XHTML" default="package">

        <import file="properties.xml" />

        <target name="clean">
                <delete dir="${outputDir}" />
        </target>

        <target name="prepare" depends="clean">
                <mkdir dir="${outputDir}" />
        </target>

        <target name="compile" depends="prepare">
                <javac
                        srcdir   ="${sourceDir}"
                        destdir  ="${outputDir}"
                        classpath="${libPath}"
                />
        </target>

        <target name="package" depends="compile">
                <echo message="mainClass=${mainClass1}"/>
                <antcall target="package">
                        <param name="mainClass" value="${mainClass1}"/>
                </antcall>
        </target>
</project>

D:\>


"Nested <reference> elements can be used to copy
references from the calling project to the new project,
optionally under a different id. References taken from
nested elements will override existing references that
have been defined outside of targets in the new project -
but not those defined inside of targets."

<http://ant.apache.org/manual/CoreTasks/antcall.html>


<reference> should be used to call the package task of
package.xml from build.xml?


thanks,

Thufir

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



The Distillery Pty Limited
ABN 69 080 932 467
PO Box 940, Dickson ACT 2602, AUSTRALIA
Phone: +61 2 6272 0200
Fax: +61 2 6262 5151
Web: www.thedistillery.com.au

The Distillery Inc
2111 Wilson Blvd, Suite 700,
Arlington, Virginia 22201, USA
Phone: +1 703 351 5082
Web: www.thedistilleryinc.com

The Distillery (Europe) Ltd
53 Chandos Place London WC2N 4HS
Tel: +44 (0)20 7812 6692
Fax: +44 (0)20 7812 6677


---------------------------------------------------------------------
The information contained in this email and any files attached may be
confidential and/or copyrighted information of The Distillery, Third
Parties and/or the intended recipient and may be the subject of legal
privilege or public interest immunity. You may only reproduce or
distribute the material if you are expressly authorised by us to do
so. If you are not the intended recipient, any use, disclosure,
copying, circulation, forwarding, printing or publication of this
message or attached files is strictly forbidden.

If you have received this document in error or are not an intended
recipient, please notify the sender and delete from your Inbox and/or
system.

The Distillery does not represent or warrant that files attached to
this e-mail are free from computer viruses or other defects and
liability is limited to the resupply (or cost of resupply) of the
attached files.
---------------------------------------------------------------------


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


Mime
View raw message