Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Ant Query

 
saumil baxi
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 34672
367
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
saumil baxi
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 34672
367
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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. [ ].
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic