aspose file tools*
The moose likes Ant, Maven and Other Build Tools and the fly likes Ant Query Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Ant Query" Watch "Ant Query" New topic
Author

Ant Query

saumil baxi
Ranch Hand

Joined: Apr 18, 2008
Posts: 58
Hi,
I am new to ANT. My need is that my ant script should read the properties file and whatever jars are mentioned in the properties file should be read and those jar would be copied from loaction A to loaction B.

Can anyone help me on this?

Thanks
Saumil
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30919
    
158

Saumil,
Let's take this in pieces. Do you know how to do any of the following:
1) Create an Ant build script that prints "hello"
2) Load a properties file in Ant
3) Copy one file to another location

Also, what format is the property file in? In particular, what properties do you need to read for determining which jars to move?


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
saumil baxi
Ranch Hand

Joined: Apr 18, 2008
Posts: 58
Let's take this in pieces. Do you know how to do any of the following:
1) Create an Ant build script that prints "hello"
2) Load a properties file in Ant
3) Copy one file to another location

The answer to the above questions is YES

Also, what format is the property file in? In particular, what properties do you need to read for determining which jars to move?

Ans: I would be storing the name of the jars in the properties files from where my script will read and copy only those jars from the common repository

I hope i have answer all your question. If you want more information please let me know

Thanks,
Saumil
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30919
    
158

Saumil,
It's good you know how to do the first three. That means you aren't brand new to Ant. (making things easier to discuss)

I'm still not clear on what format the property file is in. Here are the three options I can think of:
1) You would use the propertySelector task to get all properties beginning with "jar.*" and loop through them. (requires ant-contrib library)


2) You would loop through the list delimited by commas


3) You would use the load file task and then loop through the rows


#3 sounds like what you are describing. It's a perfectly fine format, but it's not a property file. A property file must have name=value pairs. #3 is just a regular file with the names of jars.
saumil baxi
Ranch Hand

Joined: Apr 18, 2008
Posts: 58
Thanks a lot for the reply..

i have used <patternset> for the same purpose. I list all the jars in patterset.



but i am getting one problem that if the file is not present it is not throwing any error. [ ].
 
 
subject: Ant Query