Link to home
Start Free TrialLog in
Avatar of suprapto45
suprapto45Flag for Singapore

asked on

Ant

Hello,

I have one non-web based application. I have the Ant file to create the jar file. I have another web application that uses this jar.

My client would like them to be in single codebase and one Ant file so that we can identify whether to build the jar or war file so all the source codes for the non-web based as well as the web-based will be in one project.

Is that possible? I think so but I just need some opinions from all of you. Sorry, not really sure about Ant here. Let me google it as well

David
ASKER CERTIFIED SOLUTION
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of suprapto45

ASKER

Yes CEHJ,

Thanks, I think that the separate targets are the best way to go. Basically, can I use my existing Ant xml file so...I might end up like build.xml, buildWeb.xml and buildNonWeb.xml

I think that it should be doable, am I right?

David
Sometimes this Ant *thing* and classpath are making me nuts
You don't need separate build files, just separate targets, which will probably be fairly similar, in the same build file
Thanks,

I will have a try tonight. Anyway, you can be online now, you must be close. Where are you located actually?

David
The UK - currently Somerset - sometimes London
Yeah,

So far so good. I have created two target in Ant...buildJar and buildWar. One more question. When I tried to run it using Ant, it seems that I need to specify the default in the <project> tag to allow it run otherwise, it won't run. Any idea on that? So I need to specify either
<project name="Test" default="buildJar" basedir=".">
or
<project name="Test" default="buildWar" basedir=".">

David
Yes you can specify a default and then run

ant

or else you need to specify the target:

ant buildJar

or

and buildWar
Sorry for the delay...but can I set the default to buildWar but run it using ant buildJar? I tried but it fails. It works only if you set the default to buildJar

Could be something wrong here. Let me double check

David
>>but can I set the default to buildWar but run it using ant buildJar?

Yes
Thanks. Yeah just specifying the target solves the problem.

David
:-)