Reputation: 485
Am new to Maven but am comfortable with the Ant, i like the way that maven downloads the jars and its dependencies, so i want to have maven dependency included in my Ant build script. I have seen how to use but here all the jar files are downloaded in .m2 folder, instead i need all the jars downloaded in the lib folder of my project
.
Can this be done or not,? if it can then can anybody please suggest me how to do it.
Upvotes: 4
Views: 2029
Reputation: 485
I found a way to do this. You have to give filesetid in the artifact tag and use "filesetid" to copy to the given location
<target name="maven-test">
<artifact:dependencies filesetid="build-dependency-jars">
<dependency groupId="group_id" artifactId="artifact_id" version="version" />
</artifact:dependencies>
<copy todir="./lib/">
<fileset refid="build-dependency-jars" />
<mapper type="flatten" />
</copy>
</target>
Upvotes: 0
Reputation: 4859
It is a very legit question.
Using maven ant tasks does use the generic maven repository location, simply because that would benefit all your maven projects, not just your local.
Maven uses per default a shared cache for all local project, simply because downloading commons-lang per project is sort of ridiculous.
You can specify a localRepository location for the execution (see http://maven.apache.org/ant-tasks/reference.html#localRepository) if you like.
Also, as another user says, IVY is a good match for your usecase too. If you only need to download dependencies, then IVY does just that. Maven does it, but contains more, and it depends if you really want to explore these options.
Upvotes: 2