Last Updated: February 25, 2016
· 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 name="-non-executable">
        <echo msg="Non executable" />

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] ...]]
  -h -help    print this message
  -l -list    list available targets in this project

Report bugs to <>

PS: This also works for ANT.