Maven - How to do conditional execution

Is there any way to conditionally execute a fragment in pom.xml? my requirement is to copy the file / directory to deploy the structure based on the variable defined in pom.xml ...

eg:

< if >
    < equals arg1="package" arg2="package"/>
       < then>
              ....
           < /then>
     < /if>

I don’t know how I can achieve this!

Any pointers would be much appreciated.

Thanks SR

+5
source share
2 answers

You may need Maven AntRun Plugin for this.

In general, there are no conditional expressions in POM. The only thing that looks like this: create profiles that can be activated under certain specific conditions, but they probably don't fit into your current case.

, , . , , , Maven. Maven, . , , , , , , Maven.

+4

, Maven profiles, .

Maven Ant .

+2

All Articles