How to create a jar file with a source code using ant

hello,

today we will be talking about how to create a jar file using ant build while attaching the source code with the jar.

so first we do the Build.xml, it should look something like below where you define the path the JAR, Java classes and for source code

<jar destfile="${target.dir}/my-app.jar">
    <fileset dir="${target.dir}/classes" />
    <fileset dir="${src.dir}" includes="**/*.java"/>
</jar>

then using the ant utility to compile the code and JAR it

Posted in Programming and tagged , , , , , , . Bookmark the permalink. RSS feed for this post. Leave a trackback.

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.

Swedish Greys - a WordPress theme from Nordic Themepark.