Hi,
I'm a newbie with ANT. I have a ANT build.xml file in which I'm attempting to separate certain packages from different requirements of the built.

As an example, if I have a software which consists of packages A,B,C,D and E. I have customer whom are purchasing the software, but are not interested in the incorporating packages D and E. The customer is only interested in using packages A,B and C. At the same time, I have another customer who is interested in using the entire package of the software i.e. A ...E.

How do I implement flags in ANT to ensure that certain components are not accessible by the customers if they are not being purchased?

From the attached is my build.xml, I'm attempting to exclude the following targets(listed below) so that users could not access them if they have not purchased the software with these features:
<target name = “activeCollector>
<target name = “activeGUI>
<target name = “saagui>

From the build.xml, the final built would produce 2 *.jar files i.e.
Poller_Admin_Installation_V2.0.jar
Poller_Client_Installation_V2.0.jar

Could anyone show me an example how I could implement flags in ANT prevent users from accessing certain packages within a software?

Thanks
Danny

Create supertargets building only those parts of the application you want to include.
So for example (from one of my buildfiles):

<target depends="cleanup" name="clean"/>
  <target name="precompile"/>
  <target depends="javacompile" name="compile"/>
  <target name="postcompile"/>
  <target depends="archive,javadoc,resource" name="package"/>
  <target name="deploy"/>
  <target depends="precompile,compile,test,postcompile,package,deploy" name="make"/>
  <target depends="clean,make" name="rebuild"/

make sure every single supertarget does a clean build to make sure nothing is included that wasn't ordered.

Hi jwenting,

From the example you had provided(see below), you seemed to have basically included the dependencies of the targets of interest - but how did you conditionally exclude the other target types/rules that are currently in the ANT build file without having conditions in them? Could you please help explain?

<target depends="cleanup" name="clean"/>
<target name="precompile"/>
<target depends="javacompile" name="compile"/>
<target name="postcompile"/>
<target depends="archive,javadoc,resource" name="package"/>
<target name="deploy"/>
<target depends="precompile,compile,test,postcompile,package,deploy" name="make"/>
<target depends="clean,make" name="rebuild"/>

Thanks
Danny

You'll need to structure your build (and code) in such a way that your dependencies are minimised or (if possible) eliminated.

So you get a target compileABC depending on compileA, compileB, and compileC where neither depends on any of the others.
Another target compileCDE would depend on compileC, compileD, and compileE.

You will then structure your source directories so that parts A-E don't overlap (in this example C is likely some common package shared by the others so you would have your IDE set up to link to it in the other projects).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.