aspose file tools*
The moose likes Ant, Maven and Other Build Tools and the fly likes How to forwards value from Java Servlet variables to Ant variables Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "How to forwards value from Java Servlet variables to Ant variables" Watch "How to forwards value from Java Servlet variables to Ant variables" New topic
Author

How to forwards value from Java Servlet variables to Ant variables

francisco proenca
Greenhorn

Joined: Apr 27, 2012
Posts: 3
Hi folks,

I have got a Ant xml that does some things in my environment. In my xml there are some variables eg: paths and etc, that I set them manually ever I execute it, but I have to change the value in the variable manually ever time that change something in my environment. I'd like to do this dynamically.

eg:

<property name="xxx" value="C:/xxx" />


I'd like to know, if is possible I set them dynamically through of a web interface.

Exemple:

I have a web interface with some fields, I type some values in this fields and pass to a variable in my servlet. Then, I get the values those variables that I set in my servlet and forwards to my xml Ant, to set xml Ant variables.

Anybody knows how can I resolve this ?

tks folks !

Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5845
    
    7

So you want a servlet to directly run Ant? If so, you could have the servlet set the properties as part of the ant command to run.

Another possibility: most of this functionality is already built into Jenkins. Yes, Jenkins is a Continuous Integration tool, but in realty it is just a web interface that you can use to manually or automatically run scripts (and that includes ant script).


JBoss In Action
francisco proenca
Greenhorn

Joined: Apr 27, 2012
Posts: 3
I think that I haven't been quite clear. I'd like to pass values from an Java variable to a Ant variable.

eg:

String valueJava = "C:/xxx";

to

<property name="xxx" value="C:/xxx" />

eg:

<property name="xxx" value="(String value = "C:/xxx";)" />

set String valueJava in value's property

thanks !
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5845
    
    7

How are you running Ant?
francisco proenca
Greenhorn

Joined: Apr 27, 2012
Posts: 3
In the Eclipse.
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5845
    
    7

I'm confused. I thought you wanted your Java app to run Ant. At least that is what you said here:

I'd like to pass values from an Java variable to a Ant variable.


If you are just running Ant from Eclipse, and you should be able to create multiple run configurations for Ant.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to forwards value from Java Servlet variables to Ant variables