You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by "M. Z." <co...@yahoo.com> on 2005/08/19 12:31:55 UTC

Problem with parsing ant script from URL

Hi all,

Does anybody know how to parse ant script from URL
instead of File?

What I need to do is as below:

1. I have a .jar file which contains my class file,
the ant script, and some other dirs/files.

2. As I need to call ant tasks in the java class, I'll
have to parse the ant script. However, as the script
is in .jar, I think I'll have to specify the URL
instead of File object. (Please correct me if it isn't
necessary.)

My jar contains something like this:
...
MyTest.class
Test/
Test/build.xml
Test/file
...

My MyTest.java has these lines:
...
Project project = new Project();
project.init();
URL
url=this.getClass().getClassLoader().getResource("Test/build.xml");
ProjectHelper.getProjectHelper().parse(project,url);
...

Before I packaged files in jar,everything was fine if
I use File object. But now, exception occurs at
parse().

Can anybody give any advice?

Thanks,
Amy


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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