Calling phing tasks from Eclipse

Here you can read how to run phing tasks using built-in Ant tool in Eclipse.

In this post I’ll describe what to do if your phing task requires user input. The solution is simple – ask for user property in ant and pass it back to phing:

<?xml version="1.0" encoding="UTF-8"?>
<project name="project_name">
	<property name="phing.command" value="phing" />
	<target name="task_name" description="Task description">
		<input message="Input property"
			addproperty="property_name" />
		<exec dir="" executable="${phing.command}">
			<arg line="-Dphing_task_property=${property_name}" />
			<arg line="phing_task_name" />

You also need to tell phing not to wait for user input if we’ve passed property via command line. For phing task propertyPrompt use attribute useExistingValue="true".

If your phing property has default value you need to specify this default value in ant input task also.

Tags: , ,

AddThis Social Bookmark Button

Leave a Reply