I'm attempting to add a build task into a Maven pom file so that I can transfer a jar file as well as some xml files to an SFTP server (it's a VM with Tomcat installed) but I have been unable to so far.
I've had a look at a few links, but they either don't quite match the requirements, have missing steps, or don't work. I'm basically a beginner with Maven so I'm not sure if I'm doing it correctly.
The requirement is that I want to invoke a Maven build, with command line arguments for the hostname, username, and password (which I have working) which then will upload a jar file and the xml files to a VM with Tomcat running in it via SFTP (FTP doesn't work, and I don't think SCP will work as I don't have a passfile). I also don't want to mess with the main Maven settings.xml file to add the connection details in, which some of the links I found seem to be reliant upon.
I have the following profile so far, using FTP, but it doesn't work due to not using SFTP.
<profiles>
<profile>
<!-- maven antrun:run -Pdeploy -->
<id>deploy</id>
<build>
<plugins>
<plugin>
<inherited>false</inherited>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.6</version>
<configuration>
<target>
<!-- <loadproperties srcFile="deploy.properties" /> -->
<ftp action="send" server="${server-url}"
remotedir="/usr/share/myappserver/webapps/myapp/WEB-INF/lib"
userid="${user-id}" password="${user-password}" depends="no"
verbose="yes" binary="yes">
<fileset dir="target">
<include name="artifact.jar" />
</fileset>
</ftp>
<ftp action="send" server="${server-url}"
remotedir="/var/lib/myappserver/myapp/spring"
userid="${user-id}" password="${user-password}" depends="no"
verbose="yes" binary="yes">
<fileset dir="src/main/resource/spring">
<include name="*.xml" />
</fileset>
</ftp>
<!-- calls deploy script -->
<!-- <sshexec host="host" trust="yes" username="usr" password="pw"
command="sh /my/script.sh" /> -->
<!-- SSH -->
<taskdef name="sshexec" classname="org.apache.tools.ant.taskdefs.optional.ssh.SSHExec"
classpathref="maven.plugin.classpath" />
<taskdef name="ftp"
classname="org.apache.tools.ant.taskdefs.optional.net.FTP"
classpathref="maven.plugin.classpath" />
</target>
</configuration>
<dependencies>
<dependency>
<groupId>commons-net</groupId>
<artifactId>commons-net</artifactId>
<version>1.4.1</version>
</dependency>
<dependency>
<groupId>ant</groupId>
<artifactId>ant-commons-net</artifactId>
<version>1.6.5</version>
</dependency>
<dependency>
<groupId>ant</groupId>
<artifactId>ant-jsch</artifactId>
<version>1.6.5</version>
</dependency>
<dependency>
<groupId>jsch</groupId>
<artifactId>jsch</artifactId>
<version>0.1.29</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</profile>
</profiles>
I tried swapping ftp for sftp, and using org.apache.tools.ant.taskdefs.optional.ssh.SFTP instead, but it didn't seem to work.
So to summarize, the SFTP config needs to be self contained within the pom file as much as possible, with stuff like the host url, username and password being passed in when invoked.
I'd use the Wagon Maven plugin with its goals upload-single and upload instead of antrun:
wagon:upload-single uploads the specified file to a remote location.
wagon:upload uploads the specified set of files to a remote location.
I was eventually able to get this working using PuTTy pcsp
<PUTTY_DIRECTORY>/pscp.exe" -l <USERNAME> -pw <PASSWORD> ./fileToTransfer.file <PUTTY_SESSION_ID>:/destination-directory/fileToTransfer.file
I could also run scripts using plink
<PUTTY_DIRECTORY>/plink.exe" <PUTTY_SESSION> -l <USERNAME> -pw <PASSWORD> -m ./myScriptToRunRemotely.sh
It wasn't the cleanest of solutions, but it still allows me to use it on Jenkins for deployment testing purposes.
Related
I am trying to follow along with the jOOQ tutorial. I am at Step 3 (code generation) but want to do the code generation step using Maven.
Here is the contents of my pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>net.hiew</groupId>
<artifactId>jooq-tutorial</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.jooq</groupId>
<artifactId>jooq</artifactId>
<version>3.11.2</version>
</dependency>
<dependency>
<groupId>org.jooq</groupId>
<artifactId>jooq-meta</artifactId>
<version>3.11.2</version>
</dependency>
<dependency>
<groupId>org.jooq</groupId>
<artifactId>jooq-codegen</artifactId>
<version>3.11.2</version>
</dependency>
<dependency>
<groupId>org.mariadb.jdbc</groupId>
<artifactId>mariadb-java-client</artifactId>
<version>1.1.7</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<!-- Specify the maven code generator plugin -->
<!-- Use org.jooq for the Open Source Edition
org.jooq.pro for commercial editions,
org.jooq.pro-java-6 for commercial editions with Java 6 support,
org.jooq.trial for the free trial edition
Note: Only the Open Source Edition is hosted on Maven Central.
Import the others manually from your distribution -->
<groupId>org.jooq</groupId>
<artifactId>jooq-codegen-maven</artifactId>
<version>3.11.2</version>
<executions>
<execution>
<id>jooq-codegen</id>
<phase>generate-sources</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<!-- Configure the database connection here -->
<jdbc>
<driver>org.mariadb.jdbc.Driver</driver>
<url>jdbc:mariadb://localhost:3306/library</url>
<user>root</user>
<password>mysql</password>
</jdbc>
<generator>
<!-- The default code generator. You can override this one, to generate your own code style.
Supported generators:
- org.jooq.codegen.JavaGenerator
- org.jooq.codegen.ScalaGenerator
Defaults to org.jooq.codegen.JavaGenerator -->
<name>org.jooq.codegen.JavaGenerator</name>
<database>
<!-- The database type. The format here is:
org.util.[database].[database]Database -->
<name>org.jooq.meta.mariadb.MariaDBDatabase</name>
<!-- The database schema (or in the absence of schema support, in your RDBMS this
can be the owner, user, database name) to be generated -->
<inputSchema>library</inputSchema>
<!-- All elements that are generated from your schema
(A Java regular expression. Use the pipe to separate several expressions)
Watch out for case-sensitivity. Depending on your database, this might be important! -->
<includes>.*</includes>
<!-- All elements that are excluded from your schema
(A Java regular expression. Use the pipe to separate several expressions).
Excludes match before includes, i.e. excludes have a higher priority -->
<excludes></excludes>
</database>
<target>
<!-- The destination package of your generated classes (within the destination directory) -->
<packageName>net.hiew.jooqtutorial.generated</packageName>
<!-- The destination directory of your generated classes. Using Maven directory layout here -->
<directory>/home/james/src/local/jooqtutorial/src/main/java/</directory>
</target>
</generator>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
My project directory:
The error I get when running mvn -e jooq-codegen:generate:
[INFO] --- jooq-codegen-maven:3.11.2:generate (default-cli) # jooq-tutorial ---
[ERROR] Incorrect configuration of jOOQ code generation tool
[ERROR]
The jOOQ-codegen-maven module's generator configuration is not set up correctly.
This can have a variety of reasons, among which:
- Your pom.xml's <configuration> contains invalid XML according to jooq-codegen-3.11.0.xsd
- There is a version or artifact mismatch between your pom.xml and your commandline
The error message is not that helpful, so I am not sure of the best way to debug the problem further. The pom.xml validates and the database exists and is accessible as described in the <configuration> element.
The configuration tag has to be directly under the plugin tag, not inside execution:
<plugin>
...
<executions>
...
</executions>
<configuration>
...
</configuration>
...
</plugin>
Full plugin tag:
<plugin>
<!-- Specify the maven code generator plugin -->
<!-- Use org.jooq for the Open Source Edition org.jooq.pro for commercial editions, org.jooq.pro-java-6 for commercial editions with Java 6 support, org.jooq.trial for the free trial edition Note: Only the Open Source Edition is hosted on Maven Central. Import the others manually from your distribution -->
<groupId>org.jooq</groupId>
<artifactId>jooq-codegen-maven</artifactId>
<version>3.11.2</version>
<executions>
<execution>
<id>jooq-codegen</id>
<phase>generate-sources</phase>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.mariadb.jdbc</groupId>
<artifactId>mariadb-java-client</artifactId>
<version>${mariadb.version}</version>
</dependency>
</dependencies>
<configuration>
<!-- Configure the database connection here -->
<jdbc>
<driver>org.mariadb.jdbc.Driver</driver>
<url>jdbc:mariadb://localhost:3306/library</url>
<user>root</user>
<password>mysql</password>
</jdbc>
<generator>
<!-- The default code generator. You can override this one, to generate your own code style. Supported generators: - org.jooq.codegen.JavaGenerator - org.jooq.codegen.ScalaGenerator Defaults to org.jooq.codegen.JavaGenerator -->
<name>org.jooq.codegen.JavaGenerator</name>
<database>
<!-- The database type. The format here is: org.util.[database].[database]Database -->
<name>org.jooq.meta.mariadb.MariaDBDatabase</name>
<!-- The database schema (or in the absence of schema support, in your RDBMS this can be the owner, user, database name) to be generated -->
<inputSchema>library</inputSchema>
<!-- All elements that are generated from your schema (A Java regular expression. Use the pipe to separate several expressions) Watch out for case-sensitivity. Depending on your database, this might be important! -->
<includes>.*</includes>
<!-- All elements that are excluded from your schema (A Java regular expression. Use the pipe to separate several expressions). Excludes match before includes, i.e. excludes have a higher priority -->
<excludes>
</excludes>
</database>
<target>
<!-- The destination package of your generated classes (within the destination directory) -->
<packageName>net.hiew.jooqtutorial.generated</packageName>
<!-- The destination directory of your generated classes. Using Maven directory layout here -->
<directory>/home/james/src/local/jooqtutorial/src/main/java/</directory>
</target>
</generator>
</configuration>
</plugin>
Note tha you may need to specify your mariadb version in the dependency, I added the defalut variable name.
Alternatively to wallek876's answer, you could rename your executionId to default-cli as documented here. So, this should work:
<executions>
<execution>
<id>default-cli</id>
<phase>generate-sources</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<!-- Configure the database connection here -->
<jdbc>
...
Another option, which I always prefer, is to use profiles:
<profiles>
<profile>
<id>jooq-codegen</id>
<build>
<plugins>
<plugin>
<groupId>org.jooq</groupId>
<artifactId>jooq-codegen-maven</artifactId>
<version>3.11.2</version>
...
And then, run that with
mvn install -P jooq-codegen
I want to create a pom.xml that will fetch some .dmp files from a remote FTP server ,
to access this server I have it's URL username and password (who ofcourse only have READ permissions).
What is the best way to get those files from the server?
with maven-ant plugin/maven executer/ or any other plugin that I don't know of?
try this
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.8</version>
<configuration>
<target>
<ftp action="get"
server="192.168.1.1"
remotedir="remoteDir"
userid="anonymous"
password="anonymous">
<fileset dir="${project.build.directory}">
<include name="**/*.*"/>
</fileset>
</ftp>
</target>
</configuration>
<dependencies>
<dependency>
<groupId>commons-net</groupId>
<artifactId>commons-net</artifactId>
<version>1.4.1</version>
</dependency>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant-commons-net</artifactId>
<version>1.8.1</version>
</dependency>
</dependencies>
</plugin>
Also you can have a look here
I'm working on a plugin for Talend Open Studio; the component architecture of that platform needs that all external JARs are declared in a component-descriptor XML file in a form like:
<IMPORT MODULE="commons-collections-3.2.1.jar" NAME="commons-collections-3.2.1"
REQUIRED="true"/>
I use the Maven dependency plugins to manage all these external JARs
Is there a way to get all the dependency names in a list or something? This way can I be able to build the required strings (using an antcontrib task, perhaps), fill a ${parameter} and finally add it to XML file using maven-replacer-plugin?
The simplest solution is to use the maven-dependency-plugin via the buld-classpath goal. This goal can be given supplemental parameters to put the result into a file like:
mvn dependency:build-classpath -Dmdep.outputFile=classpath.out
Ok, I partly resolved this way that should works with some limitations:
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.6</version>
<dependencies>
<dependency>
<groupId>ant-contrib</groupId>
<artifactId>ant-contrib</artifactId>
<version>1.0b3</version>
<exclusions>
<exclusion>
<groupId>ant</groupId>
<artifactId>ant</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>ant</groupId>
<artifactId>ant-nodeps</artifactId>
<version>1.6.5</version>
</dependency>
</dependencies>
<executions>
<execution>
<phase>package</phase>
<id>copy-resources</id>
<configuration>
<exportAntProperties>true</exportAntProperties>
<tasks>
<!-- add the ant tasks from ant-contrib -->
<taskdef resource="net/sf/antcontrib/antlib.xml" classpathref="maven.plugin.classpath"/>
<var name="import.set" value=""/>
<for param="file">
<path>
<fileset dir="${project.build.directory}" includes="*.jar"/>
</path>
<sequential>
<var name="basename" unset="true"/>
<basename file="#{file}" property="basename"/>
<var name="filenames" value="${basename}"/>
<var name="import.clause" value='<IMPORT MODULE="${filenames}" NAME="${filenames}" REQUIRED="true"/>'/>
<var name="import.set" value="${import.clause}${line.separator}${import.set}" />
</sequential>
</for>
<property name="import.jar" value="${import.set}"/>
<echo>${import.jar}</echo>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
Still some problems: even if exportAntProperties is set to true, the property ${import.jar} is still not available outside ant taska in other maven goals, while if i switch to maven-antrun-plugin 1.7 version, a "Error executing ant tasks: org.apache.tools.ant.launch.Locator.fromJarURI(Ljava/lang/String;)Ljava/lang/String;" exception is thrown. Still no clues...
I am migrating a project to Maven and as we were used to always reference our builds by the latest change number in our Perforce SCM repository, I would like to be able to extract this information
I am trying to configure Maven scm plugin via following resources:
http://maven.apache.org/scm/maven-scm-plugin/usage.html for generic usage
http://www.perforce.com/perforce/doc.current/manuals/p4maven/index.html
First I don't understand how to make it work, so if anybody has a fully working example, I will be happy to, on my side I have tried by adding in my pom:
<scm>
<connection>
scm:perforce:localhost:1666://depot/
<my_project>
/
<version>
</connection>
<developerConnection>
scm:perforce:localhost:1666:/depot/
<my_project>
/
<version>
</developerConnection>
<url>http://somerepository.com/view.cvs</url>
</scm>
...
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-scm-plugin</artifactId>
<version>1.6</version>
<dependencies>
<!-- P4Maven -->
<dependency>
<groupId>com.perforce</groupId>
<artifactId>p4maven</artifactId>
<version>[2011,2012)</version>
</dependency>
</dependencies>
<configuration>
<connectionType>//depot/proto/kernel/kernel/04.00/maven2</connectionType>
<username>my local username</username>
<password>xxxxxx</password>
<includes>**</includes>
</configuration>
</plugin>
</plugins>
this is leading me to:
[INFO] --- maven-scm-plugin:1.6:checkout (default-cli) # kernel ---
mars 27, 2012 9:54:08 AM org.sonatype.guice.bean.reflect.Logs$JULSink warn
Avertissement: Error injecting: org.apache.maven.scm.provider.svn.svnexe.SvnExeScmProvider
java.lang.NoClassDefFoundError: org/apache/maven/scm/command/info/InfoScmResult
Surely forgot something, I will try to read again the instructions and see what I miss, but if anybody knows ...
Anyway, my question is rather: is it worth trying it ?
I don't see in the available actions from scm plugin anything that will help me getting the last change information and integrate it into a reference build number. Shall I develop my own plugin for this ?
Thanks in advance.
I got some advice from one of the P4Maven developers that might help.
First, check your configuration. The "..." in the "" tag should be one of the tag names in the "" tag (i.e. "connection" or "developerConnection")
There two options to use Maven with Perforce SCM.
Use the default (built-in) Maven Perforce SCM provider (p4 commandline based)
Note that you'll need the p4 commandline executable installed
You can set the username and password using environment variables or JVM args
[environment variables]
P4CLIENT=
P4USER=
P4PASSWD=
or
[JVM args]
-Dusername= -Dpassword=
[pom.xml]
...
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-scm-plugin</artifactId>
<version>1.4</version>
</plugin>
...
...
<!-- SCM Settings -->
<scm>
<connection>scmerforce:localhost:1666://depot/someproject</connection>
<developerConnection>scmerforce:localhost:1666://depot/someproject</developerConnection>
<url>scmerforce://depot/simple</url>
</scm>
...
Use the P4Maven Perforce SCM provider (P4Java based)
[pom.xml]
...
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-scm-plugin</artifactId>
<version>1.4</version>
<dependencies>
<!-- P4Maven -->
<dependency>
<groupId>com.perforce</groupId>
<artifactId>p4maven</artifactId>
<version>[2011,2012)</version>
</dependency>
</dependencies>
<configuration>
<connectionType>connection</connectionType>
<username>someuser</username>
<password>somepassword</password>
<includes>**</includes>
</configuration>
</plugin>
...
...
scm4:localhost:1666://depot/someproject
scm4:localhost:1666://depot/someproject
scm4://depot/someproject
...
Note that for P4Maven we're overriding the default provider inside the "maven-scm-plugin" plugin.
Note that we're using "scmp4" (if using P4Maven) instead of "scmperforce" (built-in default) as the provider name, since "perforce" is taken by the existing default implementation.
I was struggling with exactly the same problem recently - I just wanted to get a Perforce revision number to use it in maven artifacts (for example as a part of a name). I checked buildnumber-maven-plugin, but it does not support Perforce at all. I also tried maven-release-plugin, but it seems to me as it does too much and I even didn't find out if it will do what I need.
Anyway I ended up with a solution which I don't like, but it works. I get this revision number directly with p4 executable via ant and antrun plugin (you must use the latest 1.7 version to export ant property to maven). You also need to have p4 executable available.
After this plugin configuration is used you have ${revision.number} available in maven.
<!-- Get Perforce latest change number -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<dependencies>
<dependency>
<groupId>ant-contrib</groupId>
<artifactId>ant-contrib</artifactId>
<version>1.0b3</version>
</dependency>
</dependencies>
<configuration>
<exportAntProperties>true</exportAntProperties>
</configuration>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<taskdef resource="net/sf/antcontrib/antcontrib.properties" classpath="maven.plugin.classpath"/>
<!-- Login to p4 -->
<exec executable="p4" inputstring="${p4.password}">
<arg value="-p${p4.server}"/>
<arg value="-c${p4.client}"/>
<arg value="-u${p4.username}"/>
<arg value="login"/>
</exec>
<!-- Get reivision description text -->
<exec executable="p4" outputproperty="revision.description">
<arg value="-p${p4.server}"/>
<arg value="-c${p4.client}"/>
<arg value="-u${p4.username}"/>
<arg value="changes"/>
<arg value="-m1"/>
<arg value="//...#have"/>
</exec>
<!-- Logout from p4 -->
<exec executable="p4">
<arg value="-p${p4.server}"/>
<arg value="-c${p4.client}"/>
<arg value="-u${p4.username}"/>
<arg value="logout"/>
</exec>
<!-- Parse revision description to retrieve only revision number -->
<propertyregex property="revision.number"
input="${revision.description}"
regexp="Change ([0-9]*) on ([a-z,0-9]*)"
select="\1"
casesensitive="false"/>
<echo>Perforce latest revision number: ${revision.number}</echo>
</target>
</configuration>
</execution>
</executions>
</plugin>
It's been a few years since the question was asked, but in the interval p4maven has been rewritten, and the updated documentation is startlingly hard to find.
Here's the new README.md. I followed it through and everything works. At this point, 1.0.6 is the latest version in maven central.
I discovered the source from a link on the Maven build number plugin page.
I landed here while searching for solution of a similar issue "NO Configuration could be determinded" which i faced with Code Collaborator client with P4. I ended up in uninstalling P4 client and reinstalling to get it working.
Today I wanted to perform this task, and I run across some issues in the way. So I present here my problem and the solution I found. Perhaps somebody knows a simpler solution!
The problem was this: I was trying to build a distribution package of a Java project which is built with Maven2. In a previous step, several zip files all containing a file named manifest.xml in the root were generated, and I wanted to modify this XML file in all this ZIP files. This is a scheme:
package-file-1.zip
|- contents(DIR)
\- manifest.xml
package-file-2.zip
|- contents(DIR)
\- manifest.xml
This example modifies the zip files in ${zip.sourcedir} replacing the string & with & in the file manifest.xml of all this zip files and places the modified zip files in the directory target.
For that, it uses the maven-antrun-plugin including the for and var tasks from the antcontrib tasks(http://ant-contrib.sourceforge.net). This permits to unzip the contents of every zip file into a separate directory. Note also the use of the task basename to extract the name of the zip files out of their path.
<build>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>copy-and-repair-zips</id>
<phase>initialize</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<taskdef resource="net/sf/antcontrib/antlib.xml" classpathref="maven.plugin.classpath"/>
<for param="filepath">
<path>
<fileset dir="${zip.sourcedir}" includes="**/*.zip"/>
</path>
<sequential>
<var name="for.filename" unset="true" />
<basename property="for.filename" file="#{filepath}" />
<unzip src="#{filepath}" dest="target/repair-temp/${for.filename}" encoding="UTF8" />
<replace file="target/repair-temp/${for.filename}/manifest.xml" token="&" value="&" encoding="UTF8" />
<zip basedir="target/repair-temp/${for.filename}" destfile="target/${for.filename}" encoding="UTF8" />
</sequential>
</for>
</tasks>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>ant-contrib</groupId>
<artifactId>ant-contrib</artifactId>
<version>1.0b3</version>
<exclusions>
<exclusion>
<groupId>ant</groupId>
<artifactId>ant</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
In order to write this solution, I got the needed knowledge from this URLs:
Modify a JAR(or ZIP) file using Ant: How do I modify a file in a jar file using ANT?
Unzip multiple files into separate directories: http://grokbase.com/t/ant.apache.org/user/2004/01/re-how-to-unzip-multiple-file-into-separate-directories/122a5ezxhh6eolf5enkrdfgryika
Use ant-contrib in Maven2: http://docs.codehaus.org/display/MAVENUSER/Antrun+Plugin
But be careful to use net/sf/antcontrib/antlib.xml instead of net/sf/antcontrib/antcontrib.properties to be able to use the for task
Use the ant-contrib var task: http://www.jguru.com/forums/view.jsp?EID=1374074
Edit
After posting the question, I was able to find a couple of questions related, that could help if one is having problems implementing a similar thing:
maven3 - maven-antrun-plugin - "failed to create task or type if"
Using antcontrib <if> task via maven-antrun-plugin