problem while creating jar file using ant task

View: New views
2 Messages — Rating Filter:   Alert me  

problem while creating jar file using ant task

by edumudi.viswanath@oracle.com :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

 

I need to create jar file using ant task.

 

While creating jar file, it should traverse to innermost directory & pick up all .class from from that folder.

 

The code looks like below. Here, basedir contains "${build}/classes". Classes folder contains different folders and they contains inner folders. That inner folders contain .class files.

 

<jar destfile="${build.dir}/XYZ.jar"

       basedir="${build}/classes"

       includes="${build}/classes/a/b/c/d/e/**"

  />

 

How to do that?

 

Thanks in adavance.

 

Cheers

vishy

 

 

Re: problem while creating jar file using ant task

by Stefan Bodewig :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 2009-10-07, Edumudi Viswanath <edumudi.viswanath@...> wrote:

> <jar destfile="${build.dir}/XYZ.jar"
>        basedir="${build}/classes"
>        includes="${build}/classes/a/b/c/d/e/**"
>   />

the includes pattern should be relative to your basedir.

        includes="a/b/c/d/e/**"

BTW, the recommended approach is not to use basedir at all but rather a
nested fileset.

<jar destfile="${build.dir}/XYZ.jar">
  <fileset dir="${build}/classes">
    <include name="a/b/c/d/e/**"/>
  </fileset>
</jar>

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@...
For additional commands, e-mail: user-help@...