Ant equivalent of Maven profiles?

Is there an Ant equivalent to the concept of "profile" in Maven?

I want to specify a different set of build targets (from one Ant file) depending on the argument. So in Maven, I can specify a profile and then activate it like this:mvn groupId:artifactId:goal -Denvironment=test

So say my build.xml contains:

<target name="profile1">...</>

and

<target name="profile2">...</>

How can I specify at compile time which I want to execute?

+3
source share
3 answers

You can pass ant arguments when called

ant -DProfile=foo

Then ${Profile}replacefoo

This is a complex workaround, but it should be able to pass arguments through the command line if that is your goal.

+2
source
+1

: "ant profile1". .

Seriously, the list of goals you want to accomplish is already an argument to ant. I think you need to make your example a little more explicit.

0
source

Source: https://habr.com/ru/post/1709386/


All Articles