The moose likes Ant, Maven and Other Build Tools and the fly likes ant property question Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of Practical Unit Testing with TestNG and Mockito this week in the Testing forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Reply Bookmark "ant property question" Watch "ant property question" New topic
Author

ant property question

E Weibust
Ranch Hand

Joined: Jun 13, 2003
Posts: 54
I have 2 questions.
1. How do I get property to point at a file?
Something like this:

but for a file.
Such as:

2. Why do people sometimes use the "java.source" syntax and other times just "jardir"? I see no reason for sometimes using "word.word". Why not just "source"? Why the "java." before source?
Thanks.


---<br />Erik Weibust<br /><a href="http://erik.weibust.net" target="_blank" rel="nofollow">http://erik.weibust.net</a>
Nathaniel Stoddard
Ranch Hand

Joined: May 29, 2003
Posts: 1258
Properties are not really that specific. They just allow us to specify a name and value for something. It doesn't restrict us to how the property is interpreted. Our use of the property in some context is what determines its semantics.
As far as the use of periods in properties, it is just a way to create a hierarchy of properties, or at least separate words. Just consider it something some people (like me) do to make things more readable and consistent.


Nathaniel Stodard<br />SCJP, SCJD, SCWCD, SCBCD, SCDJWS, ICAD, ICSD, ICED
E Weibust
Ranch Hand

Joined: Jun 13, 2003
Posts: 54
Nathaniel thanks for the quick reply.
Regarding your answer to my first question. Are you saying that my way for creating a property that represents a file is correct? I patterned it after the numerous examples I've found of properties pointing to directories. And from a *nix point of view a file and dir are the same(at least similar in "path" concept). I guess I'm confused on this because of filesets, patternsets, and stuff like that.
Regarding my second question. Are you saying there is no difference in "java.src", "java_src", and "javaSrc"?
Thanks
Nathaniel Stoddard
Ranch Hand

Joined: May 29, 2003
Posts: 1258
1) regarding the differences ... no, as long as you type in the same thing it doesn't matter what the name of the property is. It is just a string value.
2) regarding paths and files, you are correct and doing it just fine. Some tasks in ant require you to differentiate between directory paths and filenames. <pathelement> for example will want you to specify a directory with the "path" attribute, while specifying a file should be done with the "location" attribute.
Like I said before, the property spec is the same. All that differs is where you inject it in the rest of your build file.
E Weibust
Ranch Hand

Joined: Jun 13, 2003
Posts: 54
Beating a dead horse. Would the following be appropiate for setting up a jar dir/file?

Thanks...
Nathaniel Stoddard
Ranch Hand

Joined: May 29, 2003
Posts: 1258
Looks good to me.
I suppose the moral of the story is to explore your naming preferences, decide what works best for you, and follow it consistently.
 
 
subject: ant property question
 
Threads others viewed
Another "No suitable driver found for ..." error -- yes, it does find the driver
How to package class according directory?
ant property problems
Eclips and Ant
Simple & Basic EJB application -- Help is needed
developer file tools