Reputation:
I would like to have a "modular" (reusable) Ant build that I can reuse across multiple projects. The build might be able to take a project (directory) name as input and run the same common targets on various projects' source code. This is to prevent having the same exact (or nearly exact) build.properties
and build.xml
files for each and every project.
So, given the following setup:
build-base.properties
is a "base" props file, containing properties that will exist for all buildscriptsbuild-1.xml
uses properties defined in build-base.properties
as well as build-1.properties
build-2.xml
uses properties defined in build-base.properties
as well as build-2.properties
build-3.xml
uses properties defined in build-base.properties
as well as build-3.properties
, and uses targets defined in both build-1.xml
and build-2.xml
What would build-3.xml
need to look like (basic structure) to import/use build-base.properties
properties, and have access to build-1.xml
/build-2.xml
targets? Thanks in advance!
Upvotes: 0
Views: 302
Reputation: 6533
The best way I know to accomplish this type of modularity in Ant is to create an ant file to contain the common targets (call it common-targets.xml
or whatever you like), and use the import
task in the build-[n].xml
property files. If you have troubles with properties not sharing the way you like, you should also look at utilizing macrodef
.
Upvotes: 1