I am trying to wrap an Ant Prjoect in Maven using the maven-antrun-plugin.
This is my Plugin config
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>ant-tasks</id>
<phase>compile</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<ant antfile="build.xml"
</ant>
</target>
<ivy:settings file="../.ivy2/ivysettings.xml" />
<ivy:retrieve pattern="./[conf]/[artifact].[ext]" />
<exportAntProperties>true</exportAntProperties>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>ant</groupId>
<artifactId>ant-nodeps</artifactId>
<version>1.6.5</version>
</dependency>
<dependency>
<groupId>ant</groupId>
<artifactId>ant-apache-regexp</artifactId>
<version>1.6.5</version>
</dependency>
<dependency>
<artifactId>jakarta-regexp</artifactId>
<groupId>jakarta-regexp</groupId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>com.sun</groupId>
<artifactId>tools</artifactId>
<version>1.5.0</version>
<scope>system</scope>
<systemPath>${java.home}/../lib/tools.jar</systemPath>
</dependency>
<dependency>
<groupId>org.apache.ivy</groupId>
<artifactId>ivy</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
<version>1.7.0</version>
</dependency>
</dependencies>
</plugin>
</plugins>
The maven build is failing with error
[javac] /__w/1/s/***/src/main/java/com/******/*****/***/****/******/******.java:29: package org.apache.tools.ant.util does not exist
[javac] import org.apache.tools.ant.util.FileUtils;
I have tried setting the %ANT_HOME% variable through plugin but it doesnt work. Tried different versions of ant dependency too, different error but same result.
How do I make maven locate the Ant libraries?
PS: The build is part of a Pipeline.
The Ant build recognizes or is able to locate libraries mention in ivy.xml. Use Ivy to add all the dependencies needed during ant build. This will ensure that the Ant is able to locate its libraries during build even through maven-antrun-plugin.
Added Ant to ivy.xml and that worked.