-
-
Save debraj-manna/f8bd07a8ef5091cf644c539b2f6804a1 to your computer and use it in GitHub Desktop.
Download Maven dependencies using Ant
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<project name="lib" default="download-libs" xmlns:artifact="urn:maven-artifact-ant"> | |
<property name="maven.ant.tasks.version" value="2.1.3"/> | |
<property name="maven.ant.tasks.jar" value="maven-ant-tasks-${maven.ant.tasks.version}.jar"/> | |
<property name="maven.ant.tasks.mirror" | |
value="http://ftp.ps.pl/pub/apache/maven/ant-tasks/${maven.ant.tasks.version}/binaries/"/> | |
<target name="download-libs" depends="-init-maven-task"> | |
<artifact:dependencies pathId="dependencies.classpath"> | |
<remoteRepository id="maven-central" url="http://repo1.maven.org/maven2/"/> | |
<!-- Put dependecies here --> | |
<!-- examples: --> | |
<!-- <dependency groupId="org.codehaus.groovy" artifactId="groovy" version="1.7.2" /> --> | |
<!-- <dependency groupId="org.ccil.cowan.tagsoup" artifactId="tagsoup" version="1.2" /> --> | |
</artifact:dependencies> | |
<move todir="."> | |
<path refid="dependencies.classpath"/> | |
</move> | |
</target> | |
<target name="-init-maven-task" depends="-obtain-maven-task-jar"> | |
<available property="maven.ant.tasks.jar.exists" file="${maven.ant.tasks.jar}"/> | |
<typedef resource="org/apache/maven/artifact/ant/antlib.xml" uri="urn:maven-artifact-ant" | |
classpath="${maven.ant.tasks.jar}"/> | |
</target> | |
<target name="-obtain-maven-task-jar"> | |
<available property="maven.ant.tasks.jar.exists" file="${maven.ant.tasks.jar}"/> | |
<antcall target="download-maven-jar"/> | |
</target> | |
<target name="download-maven-jar" unless="maven.ant.tasks.jar.exists"> | |
<property name="maven.ant.tasks.url" value="${maven.ant.tasks.mirror}${maven.ant.tasks.jar}"/> | |
<get src="${maven.ant.tasks.url}" dest="${maven.ant.tasks.jar}"/> | |
</target> | |
</project> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ref - http://maven.apache.org/ant-tasks/examples/dependencies.html