Accessing Maven dependencies through Ant: Part 1: The Maven Ant Tasks

Context

I have a project which is managed by Maven. Suppose for some reason, best know to me :), I want to do the following using Ant:

  1. Inspect the project’s dependencies
  2. Zip all the dependencies together

This can be achieved by using the Maven Ant Tasks.

Project Structure

We will take the Rmi Server as an example to demonstrate how we can access Maven dependencies in Ant through the Maven Ant Tasks.

The pom.xml looks like this:

Building the project with Ant

The following is how my ant file, build-with-maven-ant-task.xml, looks:

Invoking Ant

From the command prompt, issue the following command:

ant -f build-with-maven-ant-task.xml -Dproject.name=rmi-server -Dproject.version=1.0

In the target folder, you should see the rmi-server-1.0.zip, containing all the dependencies of the project.

 

 

One thought on “Accessing Maven dependencies through Ant: Part 1: The Maven Ant Tasks

Leave a Reply

Your email address will not be published. Required fields are marked *