1

I need to create a jar with all source files attached. So for each *.class file there must be a corresponding *.java file in the same directory. I think this is something trivial, however I have not found a solution working for me so far :S.

I have also tried to use the include tag with */, but then in the created jar file there are still only *.class files and no *.java files. What am I doing wrong?

<target name="build-jar" description="Creates the jar file>
<jar jarfile="${webinf.dir}/lib/components.jar"
 basedir="${jarSource.dir}"
 includes="**/*">    
</jar>
</target>
mkn
  • 12,024
  • 17
  • 49
  • 62

1 Answers1

2

try

<jar destfile="${target.dir}/my-app.jar">
    <fileset dir="${target.dir}/classes" />
    <fileset dir="${src.dir}" includes="**/*.java"/>
</jar>
Saddam Abu Ghaida
  • 6,381
  • 2
  • 22
  • 29