user2001791
user2001791

Reputation: 1

Include ant libs from within the build file

My problem is the following: I would like to use the propertyregex task in ant. The project I am working on is built on various different servers and I don't want to configure (install the ant-nodeps.jar) every server. The source needs to include everything, that is not installed on the system by default.

So now I would need to add the ant-nodeps.jar to the ant classpath from within the build file. Does somebody know how to do that?

Cheers, Robert

Upvotes: 0

Views: 194

Answers (1)

Mark O'Connor
Mark O'Connor

Reputation: 77971

The propertyregex task is part of ant-contrib and can be installed as part of your build using Apache ivy

Checkout the following example, which demonstrates how to download and use the "for" task (also from the ant-contrib project):

The one downside is that ivy does not come pre-packaged with ANT, so the following answer has a tip on how to bootstrap your ANT builds. Once ivy is started it can be used to pull down everything else your build needs.

Update

While I understand you requirement to have no change on the target platforms, it's a very difficult problem to solve if you must also match several old versions of the build software. I have found incompatibilities between the latest ANT and 5 year old versions like 1.7 (ANT 1.6.5 is now 8 years old....)

What I do is install a very limited number of ANT versions on my Jenkins slave nodes. Build jobs can then only choose from these and then use ivy to download all other 3rd party software dependencies (This setup emulates how you'd manage a set of Maven projects).

I suspect you're using ANT to run your deployments? If that is the case I would suggest switching to something like Groovy, which can be deployed as a single jar file and can pull down dependencies on the fly, using Grape.

Upvotes: 1

Related Questions