I want to add all my source code to jar file using ant while creating jar file from source code.
I want to have two files 1- myProject.jar 2-myproject_source.jar
What should i use and where should i put it?
<project name="myProject" >
<target name="clean">
<delete dir="./build"/>
</target>
<target name="compile">
<mkdir dir="./build/classes"/>
<javac srcdir="./src" destdir="./build/classes"/>
</target>
<target name="jar">
<mkdir dir="./build/jar"/>
<jar destfile="./build/jar/DependencyFinder.jar" basedir="./build/classes">
<manifest>
<attribute name="DependencyFinder" value="main"/>
</manifest>
</jar>
</target>
</project>
Add this just before your <manifest>
line:
<fileset dir="./src" includes="**/*.java"/>
You can add mulitple <fileset>
statements if you want.