Ant + different targets

Hi all,

so I have project thats in the end has to be tested and deployed on server. I'm using Ant as runner.
I have few "build.xml"s, one with compilation targets, other with making JAR, another with deploying/redeploying application targets and so on.

For testing purposes, that is "for myself, to look how it's working" I merged all "build.xml"s altogether and made some changes inside for all process from compilation to deployment to be launched by 1 target.But now, in real task, I should have different build.xmls.

I was thinking about including all xml's in one by using <import> Ant task, but I need to be able to launch different targets from that file. For example, "compile" in one time and "deploy" other time, they shouldnt be connected (triggered).

Is it possible to select somehow target before running or I have to create different build configurations, or maybe there are some walkarounds?

Any help is greatly appreciated.
Thanks in advance.

Comment actions Permalink

Ant allows to use project name as prefix for the target. So if you set different project names in your build xml files, you will be able to call them like this:

In fact simply deploy and compile will work too, unless there is a conflict by names.

Comment actions Permalink

Maybe I was not clear at my previous post.
I attached ascreenshot

I wanted a simple way to be able to select a task for ant to run without manually rewriting targets in Build Runner properties.

The "kind of" way to achieve that, as I see it, is to make smth like follows:
Test project
-config1 (compiles)
-config2 (run tests)
-config3 (deploy)
-config4 (relax and have fun..)

and so on, so we can Run the task we need by running configuration. Of course, there has to be some dependency, for example c3 depends on c1 and c2, c2 on c1 and so on.
But in the end we'll have quite a number of different configurations. what i'm asking for is about a possibility to have something like a drop-down list next to Run button, to select needed targets there.

Is there any way to achieve that?



Comment actions Permalink

You can specify %system.ant.targets% as a value in Ant targets field on build runner page and define some default value for this parameter on the Props & Env variables step.
Then you will be able to redefine value of this parameter when you start custom build (by clicking on ... in Run button).


Please sign in to leave a comment.