Skip to main content



      Home
Home » Archived » M2M (model-to-model transformation) » [ATL] Running an ANT file with java
[ATL] Running an ANT file with java [message #58327] Fri, 17 August 2007 12:01 Go to next message
Eclipse UserFriend
Hello everybody,
I don't know if this newsgroup is the correct place to post my problem, but
I will try.
I have an ANT script (build.xml) that executes several ATL transformations.
I want to run that build.xml file from java, but I don't know how. I have
tried with:

Process proce = Runtime.getRuntime().exec("cmd /c
"+ant_home+"/bin/ant -buildfile
c:/eclipse3.3/runtime-New_configuration/Plugin/src/plugin/po pup/actions/build.xml ");




InputStream is = proce.getInputStream();

BufferedReader br = new BufferedReader (new InputStreamReader (is));


String aux = br.readLine();

while (aux!=null)

{

aux = br.readLine();

}


}catch(Exception e){

System.out.println("Error: "+e.getMessage());

}

The problem is that only the first sentence in the ANT file is executed, but
not all the script. Why?

Any idea?

Thank you very much in advance

Bea
Re: [ATL] Running an ANT file with java [message #58379 is a reply to message #58327] Fri, 17 August 2007 16:40 Go to previous messageGo to next message
Eclipse UserFriend
Hello,

Examples of running ant scripts from Java code (more specifically from
an Eclipse plugin) are available in AM3. See the ActionAnt... classes in:
http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.gmt/AM3 /org.eclipse.am3.ui/src/org/eclipse/am3/ui/action/?root=Tech nology_Project

Note that this implementation has one flaw though: the ant console is
not displayed.


As far as I know, the AM3 ant tasks have not been adapted to work
outside of Eclipse yet.


Regards,

Frédéric Jouault


bea wrote:
> Hello everybody,
> I don't know if this newsgroup is the correct place to post my problem, but
> I will try.
> I have an ANT script (build.xml) that executes several ATL transformations.
> I want to run that build.xml file from java, but I don't know how. I have
> tried with:
>
> Process proce = Runtime.getRuntime().exec("cmd /c
> "+ant_home+"/bin/ant -buildfile
> c:/eclipse3.3/runtime-New_configuration/Plugin/src/plugin/po pup/actions/build.xml ");
>
>
>
>
> InputStream is = proce.getInputStream();
>
> BufferedReader br = new BufferedReader (new InputStreamReader (is));
>
>
> String aux = br.readLine();
>
> while (aux!=null)
>
> {
>
> aux = br.readLine();
>
> }
>
>
> }catch(Exception e){
>
> System.out.println("Error: "+e.getMessage());
>
> }
>
> The problem is that only the first sentence in the ANT file is executed, but
> not all the script. Why?
>
> Any idea?
>
> Thank you very much in advance
>
> Bea
>
>
Re: [ATL] Running an ANT file with java [message #58801 is a reply to message #58379] Mon, 20 August 2007 15:42 Go to previous message
Eclipse UserFriend
Hi,
I have been looking the webpage but I don't know what variable correspond to
the ant script.
Could anybody tell me where I can find the ATL API? or help me with the java
code?
Thank you in advance
Bea

"Fr
Previous Topic:[ATL]Java Heap Space Error importing ECore Model
Next Topic:[ATL] New use case - Variability management in MDSPL
Goto Forum:
  


Current Time: Fri May 02 22:17:41 EDT 2025

Powered by FUDForum. Page generated in 0.02842 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top