# ant-user mailing list archives

##### Site index · List index
Message view
Top
From "Toomey, Kevin H (ATS, IT)" <Kevin.Too...@thehartford.com>
Subject RE: <antcall> target unable to find buildfile
Date Fri, 28 Dec 2007 16:48:11 GMT
The ":"s and "!" are the result of the "url.toExternalForm()" method call done earlier and
are valid. With that syntax, the ProjectHelper2 class is able to read the buildfile from the
classpath.
The problem occurs when during the subsequent <antcall> within the buildfile. The Ant
class uses the string ${basedir} (which is set to C:\FactoryFloor\widgets\MyApp\IterativeBuild\) and adds${ant.file} (which is set to jar:file:\C:\SDF_Factory\lib\sdfant.jar!\config\int\SDFAntCommon.xml)
and tries to find the file on the file system.

If the Ant class were to simple try and find "jar:file:\C:\SDF_Factory\lib\sdfant.jar!\config\int\SDFAntCommon.xml"
as a URL on the classpath, it would work.

Just to clarify my example, while the end goal is for this to run within a web application
(*.war), the examples shown are from me executing code using a command line and jar file containing
the ${ant.file}. -----Original Message----- From: Chuck Holzwarth [mailto:chuck_holzwarth@yahoo.com] Sent: Friday, December 28, 2007 11:30 AM To: Ant Users List Subject: Re: <antcall> target unable to find buildfile The line after the error looks like the problem. C:\FactoryFloor\widgets\MyApp\IterativeBuild\jar:file:\C:\SDF_Factory\lib\sdfant.jar!\config\int\SDFAntCommon.xml Are the ":"s and "!" valid for the path you are trying to use? "Toomey, Kevin H (ATS, IT)" <Kevin.Toomey@thehartford.com> wrote: I use Ant as the workhorse of a web application used across our enterprise for all manner of software construction tasks for ~100 applications. I have a class (AntTask) which gets instantiated for each request (build, deployment, test, etc.). The class creates an org.apache.ant.Project, sets it's properties and then sets the appropriate${ant.file} which is found via the classpath using:

URL url = cl.getResource("myAntFile"));
project.setUserProperty("ant.file", url.toExternalForm());
ProjectHelper2 ph2 = new ProjectHelper2();
ph2.parse(project, url);

I also create a temporary work area and set that as the "basedir" of the Project before running
"project.execute()".

Everything works fine unless my ${ant.file} uses the task. Even though the called target is in the same ant.file, I get an error: "java.io.FileNotFoundException: C:\FactoryFloor\widgets\MyApp\IterativeBuild\jar:file:\C:\SDF_Factory\lib\sdfant.jar!\config\int\SDFAntCommon.xml" c:\FactoryFloor\widgets\MyApp\IterativeBuild is the directory that was set as the project's${basedir}. In looking at the source files for  (CallTarget.java) and Ant (Ant.java), things
are basically working correctly. Ant.java assumes the build file is resident on the file system
either in, or relative to, the project ${basedir}. Am I missing something? Is there a way around this aside from reading the${ant.file} at startup
and then writing it to a location on the file system? That's not a huge deal to do, but I'd
rather keep everything in the *.war.

Thanks,
Kevin

*************************************************************************
This communication, including attachments, is
for the exclusive use of addressee and may contain proprietary,
confidential and/or privileged information.  If you are not the intended
recipient, any use, copying, disclosure, dissemination or distribution is
strictly prohibited.  If you are not the intended recipient, please notify
the sender immediately by return e-mail, delete this communication and
destroy all copies.
*************************************************************************

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org

Thank you,
Chuck Holzwarth
(804) 403-3478 (home)
(540) 335-3171 (cell)

---------------------------------
Never miss a thing.   Make Yahoo your homepage.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org