Last Updated: February 25, 2016
·
1.516K
· raphaelstolt

Make a Phing task private (non-executable)

For tasks which should never be called directly via the Phing Cli use the following trick to make a task private or non-executable.

<?xml version="1.0" encoding="UTF-8"?>
<project name="example-project" default="build">
    <target name="build" depends="-non-executable">
        <echo msg="Build" />
    </target>
    <target name="-non-executable">
        <echo msg="Non executable" />
    </target>
</project>

This way the -non-executable task will never be callable via the Phing Cli but still be available for orchestration within the build file.

$ phing -non-executable
Unknown argument: -non-executable
phing [options] [target [target2 [target3] ...]]
Options: 
  -h -help    print this message
  -l -list    list available targets in this project
  ....

Report bugs to <dev@phing.tigris.org>

PS: This also works for ANT.