alvin's blog

Ant FAQ: Ant copy task examples

Java Ant build FAQ: Can you share some examples of the Ant copy task, i.e., the Ant copy task syntax?

Sure. I've shared quite a few Ant examples on the website now (just search the website for "Ant"), and here's another snippet of code from an Ant build script that shows how to use the Ant copy task.

As you can see from this sample code, I'm using the Ant copy task to copy files from source locations to other destination locations.

Ant classpath - How to build a classpath variable in an Ant script

Summary: An Ant classpath example.

Here's a quick example showing how I typically build a variable to represent my classpath in an Ant build script.

Our Ant classpath example

This snippet of code below shows how I use the Ant fileset task to  create a variable named class.path by including all jar files from my lib directory using the pattern **/*.jar. This syntax can be read as "Include all files named *.jar in the lib directory and all of its sub-directories".

Syndicate content