C. Ross
C. Ross

Reputation: 31848

Ant copy file to leaf directory

I'm trying to use Apache Commons Configuration and using ant for my build tool. I have one namespaced class, and when ant builds it of course sub-directories. I need to put my .xml configuration file in the leaf directory (ie: ${build}/com/cross/xxx/). Is there an automated way to do this, or do I just manually configure the path of the leaf folder?

Upvotes: 0

Views: 1359

Answers (2)

Eddie
Eddie

Reputation: 54421

Check out the Ant copy task. You'll want to do something like this (assuming a name config.xml for your XML config file):

<copy file="config.xml" todir="${build}/com/cross/xxx/" preservelastmodified="true"/>

Of course, preservelastmodified is optional. The copy task is very powerful; above is the simplest possible sample of what it can do.

Upvotes: 2

objects
objects

Reputation: 8677

You would store your xml in the required directory in your project, either with the source file or prefereably in a separate tree eg. resources/com/cross/xxx And simply copy the entire directory tree to your build directory

Upvotes: 0

Related Questions