You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by wei wei <sn...@hotmail.com> on 2005/10/26 12:32:24 UTC
where to get some programm examples
Hello,
I have one build.xml file. now i want to control the running of this ant
build.xml in java code.
<?xml version="1.0" encoding="UTF-8"?>
<project default="build1" name="XMLExport" basedir=".">
<property environment="env"/>
<property name="temp.dir" value="../temp"/>
<property name="out.dir" value="../out"/>
<target name="build1">
<zip destfile="${out.dir}/result.zip"
basedir="${temp.dir}"/>
</target>
<target name="hello">
<echo message="Hello, world (${name})"/>
</target>
</project>
public static void main(String[] arg) {
Project project= new Project();
File buildfile = new File("build.xml");
ProjectHelperImpl helper = new ProjectHelperImpl();
helper.parse(project,buildfile);
project.setProperty("name", "wert");
project.executeTarget("hello");
then i got a very long error message, it seems like the application can not
find my ant api(.jar files).
does any one have this experience?
Thanks a lot.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: where to get some programm examples
Posted by Frank Harnack <ha...@mail05.harlau.de>.
Hello wei wei,
I am not sure what you want.
If you want to call ant directly from java, this Ant Users List message
may help you:
http://marc.theaimsgroup.com/?l=ant-user&m=112612267300036&w=2
Regards
Frank
wei wei schrieb:
> Hello,
>
> I have one build.xml file. now i want to control the running of this
> ant build.xml in java code.
> <?xml version="1.0" encoding="UTF-8"?>
> <project default="build1" name="XMLExport" basedir=".">
> <property environment="env"/>
>
> <property name="temp.dir" value="../temp"/>
> <property name="out.dir" value="../out"/>
> <target name="build1">
> <zip destfile="${out.dir}/result.zip"
> basedir="${temp.dir}"/>
> </target>
> <target name="hello">
> <echo message="Hello, world (${name})"/>
> </target>
>
> </project>
>
> public static void main(String[] arg) {
> Project project= new Project();
> File buildfile = new File("build.xml");
> ProjectHelperImpl helper = new ProjectHelperImpl();
> helper.parse(project,buildfile);
> project.setProperty("name", "wert");
> project.executeTarget("hello");
>
> then i got a very long error message, it seems like the application can
> not find my ant api(.jar files).
> does any one have this experience?
> Thanks a lot.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>
>
>
--
Frank Harnack
47269 Duisburg
Deutschland (Germany)
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: where to get some programm examples
Posted by Rhino <rh...@sympatico.ca>.
----- Original Message -----
From: "wei wei" <sn...@hotmail.com>
To: <us...@ant.apache.org>
Sent: Wednesday, October 26, 2005 6:32 AM
Subject: where to get some programm examples
> Hello,
>
> I have one build.xml file. now i want to control the running of this ant
> build.xml in java code.
> <?xml version="1.0" encoding="UTF-8"?>
> <project default="build1" name="XMLExport" basedir=".">
> <property environment="env"/>
>
> <property name="temp.dir" value="../temp"/>
> <property name="out.dir" value="../out"/>
> <target name="build1">
> <zip destfile="${out.dir}/result.zip"
> basedir="${temp.dir}"/>
> </target>
> <target name="hello">
> <echo message="Hello, world (${name})"/>
> </target>
>
> </project>
>
> public static void main(String[] arg) {
> Project project= new Project();
> File buildfile = new File("build.xml");
> ProjectHelperImpl helper = new ProjectHelperImpl();
> helper.parse(project,buildfile);
> project.setProperty("name", "wert");
> project.executeTarget("hello");
>
> then i got a very long error message, it seems like the application can
not
> find my ant api(.jar files).
> does any one have this experience?
> Thanks a lot.
>
Did you follow the instructions in the Ant manual when you installed Ant?
(The manual for the current version of Ant is at
http://ant.apache.org/manual/index.html; just click on "Installing Ant" in
the index to see the full installation instructions.)
If you have followed those instructions and are still having a problem,
please provide the following information and you will have a better chance
of getting useful help:
- the error message you are getting
- the version of Ant you are using
- the operating system and version you are using
- identify if you are using Ant in a standalone way or if you are using a
version that has been integrated with an IDE like Eclipse.
Rhino
--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.361 / Virus Database: 267.12.5/149 - Release Date: 25/10/2005
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org