Win a copy of JDBC Workbook this week in the JDBC and Relational Databases forum
or A Day in Code in the A Day in Code forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Help in writing an ANT task.

 
Ranch Hand
Posts: 280
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Friends,

Currently my project uses Maven for build. But now we want to use Ant for the build purposes. We now have a requirement to write an Ant task to take the update of the jar files using Maven whenever Ant build file is run.
Please help me in writing an ANT task for the same.

Note: On my own I searched the net and tried to implement it but didn't get much success.

Please Help.


Thanks and Regards,
Sid.
 
author & internet detective
Posts: 39986
806
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That seems like an odd requirement. Most people go from Ant to Maven and not vice versa. Also, your requirement says that you still want to use the Maven repository for your Ant build. It's not impossible though to do what you want. I just wonder what Ant + Maven repo buys you over Maven. And whether it could be better accomplished via having Ant code in your Maven pom.

On to your question. You can use dependency:get in order to pull jars without having a Maven POM. For example:
mvn -DgroupId=com.group -DartifactId=the-jar -Dversion=1.0.0 dependency:get

Which means you can write an Ant task that loops through a desired list of jars and uses <exec> to run Maven commands.

Alternatively, you could create a pom.xml for your dependencies, run it and then copy over the jars (via the assembler plugin) into your Ant build.
 
Rancher
Posts: 43016
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What, specifically, are you struggling with? Are you asking about creating an Ant task using pre-built tasks, or writing your own in Java? If the latter, start at https://coderanch.com/how-to/java/AntTask
 
I wish to win the lottery. I wish for a lovely piece of pie. And I wish for a tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic