First, according to the Maven 1.x website, the current stable version for maven 1.x is version 1.1, not 1.4. Secondly, there is no AntRun Plugin version 1.7 and, as far as I know, this is the Maven 2 plugin. Thirdly, the syntax you use is very similar to "Using Attributes" , which, again, refers to Maven 2.
So, I can miss something, but it is very confusing, and you should perhaps clarify these points in your question.
In any case, since you explicitly mentioned Maven 1, I will try to answer. If I remember well, I would write a custom goal and use Jelly core:if or core:when . To do this, enter maven.xml something like this:
<project xmlns:j="jelly:core" xmlns:ant="jelly:ant"> <goal name="my-goal"> <j:if test="${environment == 'PROD'}"> <ant:xxx .../> </j:if> </goal> </project>
I'm really not sure about the syntax, all this Maven 1 stuff is too far away, and I haven't tested it (I'm too lazy to install Maven 1). But I think you will do it. a link to the script can help you.
Honestly, I really hope you have a good reason to prefer Maven 1.x over Maven 2.x :)
UPDATE: It looks like the OP is actually using Maven 2, so I will update my question accordingly. To implement the desired behavior, you can use the Ant -contrib if task, as shown below:
<build> <plugins> <plugin> <artifactId>maven-antrun-plugin</artifactId> <version>1.3</version> <executions> <execution> <phase>compile</phase> <goals> <goal>run</goal> </goals> <configuration> <tasks> <taskdef resource="net/sf/antcontrib/antcontrib.properties" classpathref="maven.plugin.classpath" /> <if> <equals arg1="${foo}" arg2="bar" /> <then> <echo message="The value of property foo is bar" /> </then> <else> <echo message="The value of property foo is not bar" /> </else> </if> </tasks> </configuration> </execution> </executions> <dependencies> <dependency> <groupId>ant-contrib</groupId> <artifactId>ant-contrib</artifactId> <version>20020829</version> </dependency> </dependencies> </plugin> </plugins> </build>
And then call mvn compile -Dfoo=bar (this is just an example).
But all this does not mean "maven way" to do something. Now that I understand a little better than what you are trying to do (but not completely, since you did not explain your final goal), I think that using building profiles would be more appropriate and, after reading your own answer, I think that you complicating things too much (and that you're on the wrong track).
I understand that you are new to Maven, but I suggest trying it out instead of returning to Ant, or you wonβt get its benefits. In addition, when opening a question, instead of asking for a specific solution, you should rather explain your general problem, you will get better answers. I canβt give more guidance here because I donβt know what you are really trying to achieve.