$ ant clean compile notexist install
Here I get BUILD FAILED
because notexist
doesn't exist as a target, which is expected. But is there anyway to just ignore or skip unknown targets? Or maybe map unknown targets to a known target (which would be a no-op for me)?
Background
We are using Atlassian Bamboo for our CI server, and whenever we want to add an ant target to our build, we run the risk of breaking older branches of code. This is because if we run an old build through our CI, it may not contain the target and therefore fail. Thus we are reduced to editing the build.xml
file, and either use depends
or <ant>
, but this doesn't give us the flexibility we desire.
Example
Today we have:
ant clean selenium.tests
We want to add a new target to test our REST services. Target is rest.tests
. Thus, I want my command to be
ant clean selenium.tests rest.tests
But for old branches, rest.tests
doesn't exist yet. Our solution up to now has been to add rest.tests
as a dependency of selenium-tests
(since our build.xml is under version control), but this means we can't run selenium.tests
by itself.
In hindsight, we should have just created a proxy target, such as integration.tests
(we already use test
for unit tests) which would delegate to both of these two targets. But unless there is a solution to my original question, we can't even add integration.tests
to the CI.