Question about ANTs jar task

J

jy

Hy,

I need help for one point using ant.
I have a directory (/src) and I want to make a jar file using the jar
task.
The trouble is that I don't want any resulting jar file to be created
if there is no java file under (/src).
For the moment, when there is no file under (/src), the jar task
creates a jar file containing only the manifest file.

Can someone help me ?

JY
 
A

Anders =?iso-8859-1?Q?Engstr=F6m?=

* jy said:
Hy,

I need help for one point using ant.
I have a directory (/src) and I want to make a jar file using the jar
task.
The trouble is that I don't want any resulting jar file to be created
if there is no java file under (/src).
For the moment, when there is no file under (/src), the jar task
creates a jar file containing only the manifest file.

Can someone help me ?

Untested:

<target name="jar" depends="something" description="Jars the src
directory">
<jar destfile="${jar.file}" whenempty="skip">
<fileset dir="${src.dir}" includes="**/*.java"/>
</jar>
</target>

//Anders

--
/**
* Anders Engström, (e-mail address removed)
* -------------------------------------
* Your mind is like an umbrella.
* It doesn't work unless you open it.
* /Frank Zappa
*/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,053
Latest member
BrodieSola

Latest Threads

Top