Got a following build.xml string:
<jar destfile="${lib.dir}/rpt.jar" basedir="${classes.src}" excludes="**/*.java" />
I am new to Ant and i don't understand how excludes string works. What files are affected? All java source files?
Thanks.
First about the statement
<jar destfile="${lib.dir}/rpt.jar" basedir="${classes.src}" excludes="**/*.java" />
this target is used to package your files inside a jar archive
destfile : specifies the name and location of the destination file, the archive that would be created
basedir : specifies the base directory of the files that needed to be packaged. note that all files and subfolders would be included
excludes : this is used to exclude files from basedir that you dont need inside your package (jar)
Now to your question
what the above statement would do is that it will package all the files inside classes.src to $(lib.dir)/rpt.jar but will exclude any .java files found at or inside any sub folder of basedir.
EDIT : This exclude="*/.java" is generally done to exclude source code form the jar which would be used, distributed,exported etc
Yes, with your code all Java files are excluded. Take a look at the pattern definition: This page explains pretty good, how the Ant patterns work. It also contains a lot of examples illustrating it. Patterns are used everywhere, so if you continue working with Ant, you really need to understand them.
The **
basically means every sub directory. And /*.java
means every Java file in these directories.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With