Reputation: 393
New to phing, I feel dumb but when I import one build file into another. The imported build file does not execute. I must have something wrong (note that $ phing --buildfile imported.xml runs fine).
I have tried:
<?xml version="1.0" encoding="UTF-8"?>
<project name="myproject" default="project" basedir="." description="Set up project">
<target name="project">
<echo msg="Deploy" />
</target>
<import file="import.xml"/>
</project>
AND
<?xml version="1.0" encoding="UTF-8"?>
<project name="myproject" default="project" basedir="." description="Set up project">
<target name="project">
<echo msg="Deploy" />
<import file="import.xml"/>
</target>
</project>
Upvotes: 3
Views: 900
Reputation: 1759
I think that the problem is with the "namespaces". I explain you my case, that could be yours.
I have a build.xml file that imports this structure:
.
├── bin
│ ├── phing
│ │ ├── qgpl
│ │ │ ├── console.xml
│ │ │ └── folder.xml
│ │ └── skel.xml
importing these tasks at the bottom of build.xml
<import file="${tasks.dir}/phing/skel.xml" optional="false" />
<import file="${tasks.dir}/phing/qgpl/console.xml" optional="false" />
<import file="${tasks.dir}/phing/qgpl/folder.xml" optional="false" />
If the file bin/phing/qgpl/console.xml is defined with:
<project name="qgpl.console" basedir="${build.dir}" >
I get the targets duplicated:
phing -l
Buildfile: build.xml
[property] Loading etc/config.ini
[property] Loading etc/local-config.ini
[property] Loading etc/after-local-config.ini
Default target:
-------------------------------------------------------------------------------
build Build the application
Main targets:
-------------------------------------------------------------------------------
base64Encode Convertim a Base64 una cadena preguntada
[...]
qgpl_console.base64Encode Convertim a Base64 una cadena preguntada
But if there is only one base64Encode target in the project, I must to execute it with
phing base64Encode
because
phing qgpl_console.base64Encode
do nothing, no errors but nothing executed.
I fix it removing the project name keyword in the imported files
<project basedir="${build.dir}" >
And adding the "namespace" in each target
<target name="qgpl.console.base64Encode" description="Convertim a Base64 una cadena preguntada" >
<input propertyname="stringPlain">Input string to convert to Base64</input>
<qgpl.base64Encode string="${stringPlain}" returnProperty="string64" />
<echo>${string64}</echo>
</target>
I was searching in the documentation, but I don't found other way to do it.
Upvotes: 1
Reputation: 393
Nevermind, I see that you have to make a inside the default target.
so now:
<?xml version="1.0" encoding="UTF-8"?>
<project name="myproject" default="project" basedir="." description="Set up project">
<target name="project">
<echo msg="Deploy" />
<phingcall target="importedTarget" />
</target>
<import file="import.xml"/>
</project>
Upvotes: 1