GeeCON Prague 2014*
The moose likes Ant, Maven and Other Build Tools and the fly likes How to configure in Ant? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "How to configure in Ant?" Watch "How to configure in Ant?" New topic
Author

How to configure in Ant?

Jano Balakrishnan
Greenhorn

Joined: Sep 01, 2008
Posts: 27
I need to configure a batch file in Ant build.xml.I tried with
<target name="test">
<exec dir="." executable="cmd" spawn="true">
<arg line="/c start activemq.bat"/>
</exec>
</target>
<target name="default">
<antcall target="test" />
</target>
I am quite new to ant and really dont know what i am doing is correct.I am geting an error as Execute failed: java.io.IOException: java.io.IOException: cmd: not found
Please help me to solve this.
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

What version of ANT and Windows are you running on?


Cheers, Martijn - Blog,
Twitter, PCGen, Ikasan, My The Well-Grounded Java Developer book!,
My start-up.
Jano Balakrishnan
Greenhorn

Joined: Sep 01, 2008
Posts: 27
I am using Apache Ant 1.6.5 and Ubuntu(Linux)box.
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

OK, if you look at your ANT script it looks like it's trying to execute a '.bat' file (which is typically a windows batch file) using 'cmd' (which is the windows shell). You want to execute the Linux equivalents instead.
Jano Balakrishnan
Greenhorn

Joined: Sep 01, 2008
Posts: 27
You are correct.It is a mobile Application running on windows.I am asked to write a Ant build.xml file.But my machine is linux.Now i understood that why i get this error.Also is it possible to configure and run Apache ActiveMQ from ant?
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

I'm not sure if there is a an ANT task for that (I'd check the ANT documentation and especially the optional libraries documentation) but I'm pretty sure that you can have if/else cases in ANT depending on OS detection, so you could run a .sh style shell script in Linux and a .bat style batch script in windows (e.g. Depending on what OS you are running your ANT build from).

Hope that helps!
Jano Balakrishnan
Greenhorn

Joined: Sep 01, 2008
Posts: 27
Actually my requirement is :
1. Setup ANT build
2. ANT deploy to install ActiveMQ
3. ANT deploy to install the Hub and the web based testing app including the database
4. README and installation document

Can you help me to do this.
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

Originally posted by Jano Balakrishnan:
Actually my requirement is :
1. Setup ANT build
2. ANT deploy to install ActiveMQ
3. ANT deploy to install the Hub and the web based testing app including the database
4. README and installation document

Can you help me to do this.


I can point you in the right direction...

1. Setup ANT build - You've already got this I think. Important question for you though is where you are running this ANT build from. If you are running the build on a different machine to what is being deployed to then you will run across Windows vs Linux problems like you had before.

2. ANT deploy to install ActiveMQ - As per my previous post, there might be some ANT tasks to perform this (see you ANT documentation, especially around optional tasks). I'm not sure there would actually bea task to _install_ active MQ, configure it maybe.

3. ANT deploy to install the Hub and the web based testing app including the database - See above, look for ANT tasks that can help you, otherwise use shell scripts to perform the work and get ANT to call those shell scripts (some of the tasks you mention above sound complex and I doubt there are ANT tasks for all of them.)

4. README and installation document - That's easy, once you've written the docs there is a copy task in ANT to move that to where you need.

Hope that helps!
Jano Balakrishnan
Greenhorn

Joined: Sep 01, 2008
Posts: 27
Thanks a lot.Can you provide me the link for ant documentation?
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2501
    
    8

Originally posted by Jano Balakrishnan:
Thanks a lot.Can you provide me the link for ant documentation?
http://ant.apache.org/manual/


OCUP UML fundamental and ITIL foundation
youtube channel
Jano Balakrishnan
Greenhorn

Joined: Sep 01, 2008
Posts: 27
Can any body suggest how to automate ant deploy?
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

What do you mean by automate? As in run nightly? In that case you want to look at a cron job / scheduled job or (maybe) a continuous integration tool such a Cruise Control
Jano Balakrishnan
Greenhorn

Joined: Sep 01, 2008
Posts: 27
I set up ant build.On deploy of ant i need to install hub and ActiveMQ.Is this possible.
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

As I stated previously:

"3. ANT deploy to install the Hub and the web based testing app including the database - See above, look for ANT tasks that can help you, otherwise use shell scripts to perform the work and get ANT to call those shell scripts (some of the tasks you mention above sound complex and I doubt there are ANT tasks for all of them.)"

Have you taken a look for ANT tasks?
 
GeeCON Prague 2014
 
subject: How to configure in Ant?