[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Ant

Posted on 2006-05-19
12
Medium Priority
?
419 Views
Last Modified: 2010-03-31
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
0
Comment
Question by:suprapto45
  • 6
  • 6
12 Comments
 
LVL 86

Accepted Solution

by:
CEHJ earned 1600 total points
ID: 16716112
Probably all you need is to pass a parameter to ant to tell it what to build

ant -Dproject=web

or indeed just have separate targets

ant web

or

ant non-web
0
 
LVL 16

Author Comment

by:suprapto45
ID: 16716211
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
0
 
LVL 16

Author Comment

by:suprapto45
ID: 16716235
Sometimes this Ant *thing* and classpath are making me nuts
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 86

Expert Comment

by:CEHJ
ID: 16716298
You don't need separate build files, just separate targets, which will probably be fairly similar, in the same build file
0
 
LVL 16

Author Comment

by:suprapto45
ID: 16716328
Thanks,

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

David
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 16716346
The UK - currently Somerset - sometimes London
0
 
LVL 16

Author Comment

by:suprapto45
ID: 16718081
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
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 16718575
Yes you can specify a default and then run

ant

or else you need to specify the target:

ant buildJar

or

and buildWar
0
 
LVL 16

Author Comment

by:suprapto45
ID: 16719429
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
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 16719448
>>but can I set the default to buildWar but run it using ant buildJar?

Yes
0
 
LVL 16

Author Comment

by:suprapto45
ID: 16719946
Thanks. Yeah just specifying the target solves the problem.

David
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 16719956
:-)
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
I had a project requirement for a displaying a user workbench .This workbench would consist multiple data grids .In each grid the user will be able to see a large number of data. These data grids should allow the user to 1. Sort 2. Export the …
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Suggested Courses
Course of the Month19 days, 13 hours left to enroll

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question