Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ant equivalent of Maven profiles?

Tags:

maven-2

ant

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

I'd like to be able to specify a different set of targets to build (out of one Ant file) depending on an argument. So in Maven I can specify a profile and then activate it like so: mvn groupId:artifactId:goal -Denvironment=test

So say my build.xml contains:

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

and

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

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

like image 924
Cuga Avatar asked Sep 18 '25 19:09

Cuga


1 Answers

You can pass arguments to ant when you invoke it

ant -DProfile=foo

Then ${Profile} will substitute for foo

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

like image 102
sal Avatar answered Sep 20 '25 12:09

sal