tnorgd
tnorgd

Reputation: 1602

Ant task for easier deployment

We have quite a big tree of source code, parts of it are deployed as two separate jar files. We need an easy control of what goes to which jar.

So far we do this by <exclude name="" /> and <include name="" /> tags, but this is quite inconvenient. The best option would be a separate config file with all the packages listed which we could comment out when needed, say with a '#' character.

Does something similar exist or do we have to write a new ant task that reads such a file and runs a <jar> task?

Upvotes: 1

Views: 131

Answers (2)

Mads Hansen
Mads Hansen

Reputation: 66714

ANT includes and excludes can be managed with external files and referenced in a fileset using includesfile and excludesfile attributes.

includesfile the name of a file; each line of this file is taken to be an include pattern.
excludesfile the name of a file; each line of this file is taken to be an exclude pattern.

For example:

 <jar destfile="${dist}/lib/app1.jar">
   <fileset dir=".">
    <includesfile name="app1.properties"/>
   </fileset>
  </jar>
 <jar destfile="${dist}/lib/app2.jar">
   <fileset dir=".">
    <includesfile name="app2.properties"/>
   </fileset>
  </jar>

Upvotes: 1

FrVaBe
FrVaBe

Reputation: 49341

The best option would bee to seperate the code into different modules which can be build on their own (of course with dependencies to each other). Doing this also makes cyclic dependencies obvious and gives you the chance to optimize your code base.

Upvotes: 3

Related Questions