• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 423
  • Last Modified:

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
0
suprapto45
Asked:
suprapto45
  • 6
  • 6
1 Solution
 
CEHJCommented:
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
 
suprapto45Author Commented:
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
 
suprapto45Author Commented:
Sometimes this Ant *thing* and classpath are making me nuts
0
Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

 
CEHJCommented:
You don't need separate build files, just separate targets, which will probably be fairly similar, in the same build file
0
 
suprapto45Author Commented:
Thanks,

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

David
0
 
CEHJCommented:
The UK - currently Somerset - sometimes London
0
 
suprapto45Author Commented:
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
 
CEHJCommented:
Yes you can specify a default and then run

ant

or else you need to specify the target:

ant buildJar

or

and buildWar
0
 
suprapto45Author Commented:
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
 
CEHJCommented:
>>but can I set the default to buildWar but run it using ant buildJar?

Yes
0
 
suprapto45Author Commented:
Thanks. Yeah just specifying the target solves the problem.

David
0
 
CEHJCommented:
:-)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

  • 6
  • 6
Tackle projects and never again get stuck behind a technical roadblock.
Join Now