Managing DataPower Using Apache Maven

For many projects it might be desirable to use Apache Maven to update DataPower configuration or to upload files to a device.
This has several benefits:

  • Maven is a de-facto standard tool for building Java EE applications, so using the same tool to perform DataPower management tasks is convenient.
  • Integration with the Maven lifecycle and phases (e.g., running integration tests after uploading an XSLT file to the device).
  • Usage of Maven profiles so that DataPower connection properties could be defined as part of a profile.

This can be accomplished by invoking dpbuddy's Ant tasks using Maven's AntRun plugin.

Following is the example:

        <target xmlns:dp="antlib:com.myarch.dpbuddy">
            <taskdef uri="antlib:com.myarch.dpbuddy"
                    <fileset dir="${dpbuddy.home}/lib" includes="*.jar"/>

            <dp:copy flatten="true">
                <dpFileset prefix="service-wsdl" dir="${resourcesDir}" includes="**/wsdl"/>


Note how you can define a prefix for custom dpbuddy tasks as part of the "target".

You should be using Maven instead of Ant for managing properties, so "dpbuddy.home" and "resourcesDir" can be defined in the POM itself (or you can use properties plugin if you want storing properties in a separate file) :


You can use Maven profiles to define DataPower connection properties:

        <dp.password>EXAMPLE ONLY</dp.password>

To execute our dpbuddy tasks simply run
mvn antrun:run -P dev

Note that we did not attach our configuration to any Maven phase; you can do it by defining the target as part of the plugin's "execution" element, there are numerous examples in the plugin's documentation.