The answer to your question is no.
However, you can use properties to enable / disable goals as follows:
<target name="resolve-ivy" if="use.ivy"> <ivy:cachepath pathid="path.pmd".... </target> <target name="resolve-ant" unless="use.ivy"> <path id="path.pmd"> <pathelement location="/path/to/pmd/jar/pmd.jar"/> </path> </target> <target name="create-tasks" depends="resolve-ivy,resolve-ant"> <taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask" classpathref="path.pmd" /> </target>
So, if the "use.ivy" property is set, your assembly will use ivy to load the dependencies of the assembly.
I have a number of observations ....
Is this warning really ignorant?
Why are you using two mechanisms to control your assembly class paths?
If you are using Eclipse, perhaps investigate the use of the Eclipse plugin and external ivy.xml to track dependencies between projects. This approach will synchronize the class paths used by both ANT and Eclipse.
PMD Modules at Maven Central
ivy pulls the wrong module from Maven Central. Latest version of PMD 5.0.1:
I would suggest the following alternative configuration of ivy tasks
<ivy:cachepath pathid="path.pmd"> <dependency org="net.sourceforge.pmd" name="pmd" rev="5.0.1" conf="default"/> </ivy:cachepath>
NOTE:
Did you consider Sonar?
Perhaps an easier way to enable PMD is to use the Sonar ANT task , which will also analyze your code using Findbugs and Checkstyle.
This task can also be restored using ivy:
<ivy:cachepath pathid="path.sonar"> <dependency org="org.codehaus.sonar-plugins" name="sonar-ant-task" rev="2.0" conf="conf"/> </ivy:cachepath>
source share