Aks
Aks

Reputation: 271

Add non-class files (includes folders and files) to your jar using build.xml

I have a java project (MyProject) with the below mentioned structure

src->package1(read as com.test.Atrribute)->File1.java,File2.java

src->package2(read as com.test.Objects)->obj1.java,obj2.java

src->directory(read as Webcontent.Objects)-> Folder1 -> application.properties file and some more files

Currently the build.xml creates a jar for the above project and copies the class files from package1 and package2.

However, my jar should also include the folder(Webcontent.Objects) with all the content's within it (i.e folders and files).

How can I do this in the build.xml ?

I have never created a build.xml before and pretty much new to all this.

Following is the jar task in the build.xml to include the class file's in the jar.

<target name="MyProject-jar" depends="compile"  
        description="Jar for the Project">        
  <jar destfile="${output.dir}/MyProject.jar" basedir="${output.dir}/">
    <include name="com/test/Attribute/*.class"/>
    <include name="com/test/Objects/*.class"/>          
  </jar>
</target>

Appreciate if anybody could help.Thanks.

Upvotes: 3

Views: 2061

Answers (1)

Attila
Attila

Reputation: 28802

You could add

<include name="Webcontent/Objects/**/*"/>

to your jar task

Note: The ** recursively considers directories under its parent

Upvotes: 0

Related Questions