Accessing Maven dependencies through Ant: Part 2: The Aether Ant Tasks

Posted by {"name"=>"Palash Ray", "email"=>"paawak@gmail.com", "url"=>"https://www.linkedin.com/in/palash-ray/"} on August 12, 2014 · 1 min read

Context

This is the 2nd increment of this series. Here is Part 1:
http://palashray.com/accessing-maven-dependencies-through-ant-part-1-the-maven-ant-tasks/
The context and the problem remains same: we want to access Maven dependencies through Ant. We will continue using the Rmi Server as an example.

What is Aether?

Aether is an API which facilitates accessing artifacts from various repositories like Maven, Nexus, Central, etc. From Maven 3 onwards, Maven is fully Aether compliant.

Disclaimer

I was not able to get Aether work on a complex Maven project having both Spring 2.x and 3.x: it invariably messes up. But with simpler modules, it seems to work fine. Though Aether is still very much bleeding edge and yet to stabilize, I believe thats the way to go, as it makes accessing artifacts language agnostic.

Using the Aether Ant Tasks

This is how my ant file build-with-aether-ant-task.xml looks like:


	
		
			
		
	
	
	
		
	
	
		
	
	
		
	
	
	
		
		
	
	
		
		
		
			
			
		
		
			
		
	
	
		
	

Invoking Ant

Use the following command:

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

You should see a zip with all the dependencies in the target folder.