You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by James Bullington <sh...@yahoo.com> on 2002/03/01 16:54:31 UTC

Re: is there an API to get a build file from an instance of Project

I wrote a simple routine to grab information from XML files and build a
new XML file.
I did this by
1. Setting up a header in a new file
2. Grabbing XML info from existing files
3. Appending the XML info to this new file
4. Adding on a trailer to the new file

Java makes it really simple to grab all information between tags and
add new info.

It would, however, be a nice touch if ant could build new build files.

--Jim

--- Dimitriy Trifonov <d_...@prosyst.bg> wrote:
> Hi all.
> I'm trying to use the ANT API to automatically generate or modify a
> build.xml 
> I load the file in a Project, then add some Targets. Is the a way to
> get the new buld file without writing an iterator over the Project?
> Suppose that I have the following code :
> 
> 
> import org.apache.tools.ant.*;
> import java.io.File;
> 
> public class TestANTProject {
>   
>   
>   private static String buildFile = "D:\\TestFiles\\aa\\build.xml";
> 
>   public static void main(String[] arg) {
>     File file = new File(buildFile);
>     Project project = new Project();
>     project.init();
>     ProjectHelper.configureProject(project, file);
>     Target targ = new Target();
>     targ.setName("newTarget");
>     //add some tasks to targ
>     project.addTarget(targ);
>   }
> 
> }
> 
> Can I get the modified xml, or I have to add the new targets into the
> xml? 
> Thanks in advance.
> 
> 
> Best Regards, 
> Dima 
> 
> Why do you necessarily have to be wrong just because a few million
> people think you are?
>
----------------------------------------------------------------------------------
> ProSyst Bulgaria LTD      Dimitriy Trifonov, 
> 48 "Vladajska" Str.,         Project Manager 
> 1606 Sofia, Bulgaria        Phone (+359 2) 952 35 82\123
> http://www.prosyst.com   mailto:d_trifonov@prosyst.bg
>
----------------------------------------------------------------------------------
> Leading Software Technology for Open Service Gateways
> 
> 
> 
> 


=====
"Those who live in the shelter of the Most High will find rest in the shadow of the Almighty.
This I declare of the Lord:  He alone is my refuge, my place of safety; he is my God, and I am trusting him�"

Psalms 91:1-2 (New Living Translation)

__________________________________________________
Do You Yahoo!?
Yahoo! Greetings - Send FREE e-cards for every occasion!
http://greetings.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: is there an API to get a build file from an instance of Project

Posted by James Bullington <sh...@yahoo.com>.
Thanks,  

This might solve some of my problems more elegantly than my current
solution, although it involves a little poking around with XSL.

--Jim

--- Erik Hatcher <ja...@ehatchersolutions.com> wrote:
> From: "James Bullington" <sh...@yahoo.com>
> 
> > I wrote a simple routine to grab information from XML files and
> build a
> > new XML file.
> > I did this by
> > 1. Setting up a header in a new file
> > 2. Grabbing XML info from existing files
> > 3. Appending the XML info to this new file
> > 4. Adding on a trailer to the new file
> > 
> > Java makes it really simple to grab all information between tags
> and
> > add new info.
> > 
> > It would, however, be a nice touch if ant could build new build
> files.
> 
> It does.... its called <style>  :))
> 
>     Erik
> 
> 
> 
> --
> To unsubscribe, e-mail:  
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 


=====
"Those who live in the shelter of the Most High will find rest in the shadow of the Almighty.
This I declare of the Lord:  He alone is my refuge, my place of safety; he is my God, and I am trusting him�"

Psalms 91:1-2 (New Living Translation)

__________________________________________________
Do You Yahoo!?
Yahoo! Greetings - Send FREE e-cards for every occasion!
http://greetings.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: is there an API to get a build file from an instance of Project

Posted by Erik Hatcher <ja...@ehatchersolutions.com>.
From: "James Bullington" <sh...@yahoo.com>

> I wrote a simple routine to grab information from XML files and build a
> new XML file.
> I did this by
> 1. Setting up a header in a new file
> 2. Grabbing XML info from existing files
> 3. Appending the XML info to this new file
> 4. Adding on a trailer to the new file
> 
> Java makes it really simple to grab all information between tags and
> add new info.
> 
> It would, however, be a nice touch if ant could build new build files.

It does.... its called <style>  :))

    Erik



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: is there an API to get a build file from an instance of Project

Posted by Dimitriy Trifonov <d_...@prosyst.bg>.
Hi, Jim.

Thanks. Unfortunately, I have to stick to the API in order to produce a
visual tool for creating, modifying and running a build file and the problem
is in modifying it without loosing the comments. Creating my own API for xml
files will threaten the deadline badly. Guess I'll skip the modifying of the
xml now :(

Have a nice weekend. If I find something I can mail you if you want.


--
Best Regards,
Dima

Why do you necessarily have to be wrong just because a few million people
think you are?



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>