You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Mitch Gitman <mg...@gmail.com> on 2009/01/21 00:25:27 UTC

jar task collapsing non-Java, non-class files

I'm using a fileset as a nested element of the jar Ant task. When the
fileset consists of .class files or .java files, the archiving takes place
correctly:
* com
    * mycompany
        * myproject
            * SomeClass.class

But when the fileset consists of some other kind of file, like XML files or
properties files, the archiving collapses the directory structure:
* com.mycompany.myproject
    * SomeProperties.properties

Why is the jar task doing this collapsing and how do I avoid it?

Re: jar task collapsing non-Java, non-class files

Posted by Mitch Gitman <mg...@gmail.com>.
Well, this is one of those times when I have to stand in awe at just how
phenomenally stupid I am. Ant wasn't collapsing or flattening anything. The
directories were collapsed/flattened to begin with in source.

As often happens with matters of this sort, I'm happy to share a little bit
of the blame with Eclipse.

On Tue, Jan 20, 2009 at 3:36 PM, Mitch Gitman <mg...@gmail.com> wrote:

> Here's a little experiment that reduces the problem to its simplest case.
> Suppose for argument's sake I'm not jarring any class files. Here's a
> passage that works:
>       <fileset id="sub.resources.fileset.for.jar" dir="${main.java.dir}" *
> includes="**/*.java"* />
>       <jar destfile="${target.dir}/${jarArtifactName}.jar">
>         <fileset refid="sub.resources.fileset.for.jar" />
>       </jar>
>
> But suppose I change just one small thing. From this:
> includes="**/*.java"
> To *this*:
> includes="**/*.xml"
>
> Suddenly now, the jar task collapses the directory structure.
>
>
> On Tue, Jan 20, 2009 at 3:25 PM, Mitch Gitman <mg...@gmail.com> wrote:
>
>> I'm using a fileset as a nested element of the jar Ant task. When the
>> fileset consists of .class files or .java files, the archiving takes place
>> correctly:
>> * com
>>     * mycompany
>>         * myproject
>>             * SomeClass.class
>>
>> But when the fileset consists of some other kind of file, like XML files
>> or properties files, the archiving collapses the directory structure:
>> * com.mycompany.myproject
>>     * SomeProperties.properties
>>
>> Why is the jar task doing this collapsing and how do I avoid it?
>>
>
>

Re: jar task collapsing non-Java, non-class files

Posted by Mitch Gitman <mg...@gmail.com>.
Here's a little experiment that reduces the problem to its simplest case.
Suppose for argument's sake I'm not jarring any class files. Here's a
passage that works:
      <fileset id="sub.resources.fileset.for.jar" dir="${main.java.dir}" *
includes="**/*.java"* />
      <jar destfile="${target.dir}/${jarArtifactName}.jar">
        <fileset refid="sub.resources.fileset.for.jar" />
      </jar>

But suppose I change just one small thing. From this:
includes="**/*.java"
To *this*:
includes="**/*.xml"

Suddenly now, the jar task collapses the directory structure.

On Tue, Jan 20, 2009 at 3:25 PM, Mitch Gitman <mg...@gmail.com> wrote:

> I'm using a fileset as a nested element of the jar Ant task. When the
> fileset consists of .class files or .java files, the archiving takes place
> correctly:
> * com
>     * mycompany
>         * myproject
>             * SomeClass.class
>
> But when the fileset consists of some other kind of file, like XML files or
> properties files, the archiving collapses the directory structure:
> * com.mycompany.myproject
>     * SomeProperties.properties
>
> Why is the jar task doing this collapsing and how do I avoid it?
>