You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Guruprasad R <gu...@gmail.com> on 2006/01/17 12:49:24 UTC

Jar task

i am creating a jar file using the below ant script.

 <target name="makejar" depends="buildejb">
  <jar jarfile="${src}/classes/npacejb.jar" basedir="${src}/classes">
   <fileset dir="${src}/classes" includes="**/*.*"/>
  </jar>
 </target>

The created jar file has all the files twice in it, with the same path. ex:
there are 2 files named as weblogic-ejb-jar.xml with the same path.
i have another problem. there are several files whose *path* is META-INF.
but i am getting the META-INF in small letters. how can i change this
meta-inf to META-INF?

Re: Jar task

Posted by Clifton Craig <cc...@gbg.com>.
Windows is a tricky beast. It's like WYSINWYG, (What You See Is NOT What You 
Get). The directory casing listed by the dir command will not be what is 
actually stored. That is why I suggested you use the jar -tvf command which 
should show you exactly how the casing appears in the jar. You might want to 
also check out WinRAR which is one of the better archiving tools for Windows. 
I don't use Windows anymore (unless I'm at home) so I can't verify the 
commands for you.
--------------------------------------------------- 
Clifton C. Craig, Software Engineer
Intelligent Computer Systems -  A Division of GBG
ccc@icsaward.com
ccraig@gbg.com

On Tuesday 17 January 2006 8:59 am, Guruprasad R wrote:
> well, one interesting thing i saw in the jar file when i opened it with
> winzip is that all the uppercase is stored as lowercase. but when u unzip
> it, u will get the folders named with proper uppercase/lowercase.
>
> On 1/17/06, Clifton Craig <cc...@gbg.com> wrote:
> > On Tuesday 17 January 2006 6:49 am, Guruprasad R wrote:
> > > i am creating a jar file using the below ant script.
> > >
> > >  <target name="makejar" depends="buildejb">
> > >   <jar jarfile="${src}/classes/npacejb.jar" basedir="${src}/classes">
> > >    <fileset dir="${src}/classes" includes="**/*.*"/>
> > >   </jar>
> > >  </target>
> > >
> > > The created jar file has all the files twice in it, with the same path.
> >
> > ex:
> > > there are 2 files named as weblogic-ejb-jar.xml with the same path.
> > > i have another problem. there are several files whose *path* is
> >
> > META-INF.
> >
> > > but i am getting the META-INF in small letters. how can i change this
> > > meta-inf to META-INF?
> >
> > Try the following on the command line in the ${src}/classes folder:
> > jar -tvf npacejb.jar
> >
> > If that shows the path in the jar as meta-inf then use:
> > <jar jarfile="${src}/classes/npacejb.jar" basedir="${src}/classes">
> >        <metainf dir="${src}/classes/meta-inf"/>
> > </jar>
> >
> > If you have a manifest already in the ${src}/classes/meta-inf folder then
> > you'll tuck an inlined <manifest/> element in the jar task to create it
> > in the resulting jar.
> > --
> > Clifton C. Craig, Software Engineer
> > Intelligent Computer Systems - A Division of GBG
> > ccc@icsaward.com
> > ccraig@gbg.com
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> > For additional commands, e-mail: user-help@ant.apache.org

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


Re: Jar task

Posted by Guruprasad R <gu...@gmail.com>.
well, one interesting thing i saw in the jar file when i opened it with
winzip is that all the uppercase is stored as lowercase. but when u unzip
it, u will get the folders named with proper uppercase/lowercase.

On 1/17/06, Clifton Craig <cc...@gbg.com> wrote:
>
> On Tuesday 17 January 2006 6:49 am, Guruprasad R wrote:
> > i am creating a jar file using the below ant script.
> >
> >  <target name="makejar" depends="buildejb">
> >   <jar jarfile="${src}/classes/npacejb.jar" basedir="${src}/classes">
> >    <fileset dir="${src}/classes" includes="**/*.*"/>
> >   </jar>
> >  </target>
> >
> > The created jar file has all the files twice in it, with the same path.
> ex:
> > there are 2 files named as weblogic-ejb-jar.xml with the same path.
> > i have another problem. there are several files whose *path* is
> META-INF.
> > but i am getting the META-INF in small letters. how can i change this
> > meta-inf to META-INF?
> Try the following on the command line in the ${src}/classes folder:
> jar -tvf npacejb.jar
>
> If that shows the path in the jar as meta-inf then use:
> <jar jarfile="${src}/classes/npacejb.jar" basedir="${src}/classes">
>        <metainf dir="${src}/classes/meta-inf"/>
> </jar>
>
> If you have a manifest already in the ${src}/classes/meta-inf folder then
> you'll tuck an inlined <manifest/> element in the jar task to create it in
> the resulting jar.
> --
> Clifton C. Craig, Software Engineer
> Intelligent Computer Systems - A Division of GBG
> ccc@icsaward.com
> ccraig@gbg.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>

Re: Jar task

Posted by Clifton Craig <cc...@gbg.com>.
On Tuesday 17 January 2006 6:49 am, Guruprasad R wrote:
> i am creating a jar file using the below ant script.
>
>  <target name="makejar" depends="buildejb">
>   <jar jarfile="${src}/classes/npacejb.jar" basedir="${src}/classes">
>    <fileset dir="${src}/classes" includes="**/*.*"/>
>   </jar>
>  </target>
>
> The created jar file has all the files twice in it, with the same path. ex:
> there are 2 files named as weblogic-ejb-jar.xml with the same path.
> i have another problem. there are several files whose *path* is META-INF.
> but i am getting the META-INF in small letters. how can i change this
> meta-inf to META-INF?
Try the following on the command line in the ${src}/classes folder:
jar -tvf npacejb.jar

If that shows the path in the jar as meta-inf then use:
<jar jarfile="${src}/classes/npacejb.jar" basedir="${src}/classes">
	<metainf dir="${src}/classes/meta-inf"/>
</jar>

If you have a manifest already in the ${src}/classes/meta-inf folder then 
you'll tuck an inlined <manifest/> element in the jar task to create it in 
the resulting jar.
-- 
Clifton C. Craig, Software Engineer
Intelligent Computer Systems -  A Division of GBG
ccc@icsaward.com
ccraig@gbg.com

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


Re: Jar task

Posted by Clifton Craig <cc...@gbg.com>.
On Tuesday 17 January 2006 6:49 am, Guruprasad R wrote:
> i am creating a jar file using the below ant script.
>
>  <target name="makejar" depends="buildejb">
>   <jar jarfile="${src}/classes/npacejb.jar" basedir="${src}/classes">
>    <fileset dir="${src}/classes" includes="**/*.*"/>
>   </jar>
>  </target>
>
> The created jar file has all the files twice in it, with the same path. ex:
> there are 2 files named as weblogic-ejb-jar.xml with the same path.
> i have another problem. there are several files whose *path* is META-INF.
> but i am getting the META-INF in small letters. how can i change this
> meta-inf to META-INF?

Also, I am wondering about your project layout. It doesn't seem like a good 
idea to have build output (binaries, etc.) under your src folder. Instead 
maybe you can consider a separate conventional ${build.dir} folder where ALL 
build output (classes, jars, binaries, generated source code, etc.) goes? 
That would definitely save you in the near future should you need to sort 
things out for, say, a source control system. Consider something like this:

projdir
|
*-build
|  |
|  *-classes
|  |
|  *-jars
|
*-src
|  |
|  *-java
|  |
|  *-tests
|
*-build.xml

-- 
Clifton C. Craig, Software Engineer
cliff@javalobby.org

-- 
Clifton C. Craig, Software Engineer
Intelligent Computer Systems -  A Division of GBG
ccc@icsaward.com
ccraig@gbg.com

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


Re: Jar task

Posted by Guruprasad R <gu...@gmail.com>.
thanx Jeffrey, the duplicates have been removed.

On 1/17/06, Guruprasad R <gu...@gmail.com> wrote:
>
> i am opening the jar file with winzip and i can see the path as
> ''meta-inf'.
>
> On 1/17/06, Jeffrey E Care <ca...@us.ibm.com> wrote:
> >
> > As for the duplicates, either use the basedir, or use the nested
> > fileset:
> > not both.
> >
> > As for META-INF, how do you know that it is lowercased in the JAR?
> >
> > --
> > Jeffrey E. Care (carej@us.ibm.com)
> > WebSphere v7 Release Engineer
> > WebSphere Build Tooling Lead (Project Mantis)
> >
> >
> > Guruprasad R < guruprasad81@gmail.com> wrote on 01/17/2006 06:49:24 AM:
> >
> > > i am creating a jar file using the below ant script.
> > >
> > >  <target name="makejar" depends="buildejb">
> > >   <jar jarfile="${src}/classes/npacejb.jar" basedir="${src}/classes">
> > >    <fileset dir="${src}/classes" includes="**/*.*"/>
> > >   </jar>
> > >  </target>
> > >
> > > The created jar file has all the files twice in it, with the same
> > path.
> > ex:
> > > there are 2 files named as weblogic-ejb-jar.xml with the same path.
> > > i have another problem. there are several files whose *path* is
> > META-INF.
> > > but i am getting the META-INF in small letters. how can i change this
> > > meta-inf to META-INF?
> >
> >
>

Re: Jar task

Posted by Jeffrey E Care <ca...@us.ibm.com>.
Don't trust winzip - use a real unzip program and actually unzip it.

-- 
Jeffrey E. Care (carej@us.ibm.com)
WebSphere v7 Release Engineer
WebSphere Build Tooling Lead (Project Mantis)




Guruprasad R <gu...@gmail.com> 
01/17/2006 06:55 AM
Please respond to
"Ant Users List" <us...@ant.apache.org>


To
Ant Users List <us...@ant.apache.org>
cc

Subject
Re: Jar task






i am opening the jar file with winzip and i can see the path as 
''meta-inf'.

On 1/17/06, Jeffrey E Care <ca...@us.ibm.com> wrote:
>
> As for the duplicates, either use the basedir, or use the nested 
fileset:
> not both.
>
> As for META-INF, how do you know that it is lowercased in the JAR?
>
> --
> Jeffrey E. Care (carej@us.ibm.com)
> WebSphere v7 Release Engineer
> WebSphere Build Tooling Lead (Project Mantis)
>
>
> Guruprasad R <gu...@gmail.com> wrote on 01/17/2006 06:49:24 AM:
>
> > i am creating a jar file using the below ant script.
> >
> >  <target name="makejar" depends="buildejb">
> >   <jar jarfile="${src}/classes/npacejb.jar" basedir="${src}/classes">
> >    <fileset dir="${src}/classes" includes="**/*.*"/>
> >   </jar>
> >  </target>
> >
> > The created jar file has all the files twice in it, with the same 
path.
> ex:
> > there are 2 files named as weblogic-ejb-jar.xml with the same path.
> > i have another problem. there are several files whose *path* is
> META-INF.
> > but i am getting the META-INF in small letters. how can i change this
> > meta-inf to META-INF?
>
>


Re: Jar task

Posted by Guruprasad R <gu...@gmail.com>.
i am opening the jar file with winzip and i can see the path as ''meta-inf'.

On 1/17/06, Jeffrey E Care <ca...@us.ibm.com> wrote:
>
> As for the duplicates, either use the basedir, or use the nested fileset:
> not both.
>
> As for META-INF, how do you know that it is lowercased in the JAR?
>
> --
> Jeffrey E. Care (carej@us.ibm.com)
> WebSphere v7 Release Engineer
> WebSphere Build Tooling Lead (Project Mantis)
>
>
> Guruprasad R <gu...@gmail.com> wrote on 01/17/2006 06:49:24 AM:
>
> > i am creating a jar file using the below ant script.
> >
> >  <target name="makejar" depends="buildejb">
> >   <jar jarfile="${src}/classes/npacejb.jar" basedir="${src}/classes">
> >    <fileset dir="${src}/classes" includes="**/*.*"/>
> >   </jar>
> >  </target>
> >
> > The created jar file has all the files twice in it, with the same path.
> ex:
> > there are 2 files named as weblogic-ejb-jar.xml with the same path.
> > i have another problem. there are several files whose *path* is
> META-INF.
> > but i am getting the META-INF in small letters. how can i change this
> > meta-inf to META-INF?
>
>

Re: Jar task

Posted by Jeffrey E Care <ca...@us.ibm.com>.
As for the duplicates, either use the basedir, or use the nested fileset: 
not both.

As for META-INF, how do you know that it is lowercased in the JAR?

-- 
Jeffrey E. Care (carej@us.ibm.com)
WebSphere v7 Release Engineer
WebSphere Build Tooling Lead (Project Mantis)


Guruprasad R <gu...@gmail.com> wrote on 01/17/2006 06:49:24 AM:

> i am creating a jar file using the below ant script.
> 
>  <target name="makejar" depends="buildejb">
>   <jar jarfile="${src}/classes/npacejb.jar" basedir="${src}/classes">
>    <fileset dir="${src}/classes" includes="**/*.*"/>
>   </jar>
>  </target>
> 
> The created jar file has all the files twice in it, with the same path. 
ex:
> there are 2 files named as weblogic-ejb-jar.xml with the same path.
> i have another problem. there are several files whose *path* is 
META-INF.
> but i am getting the META-INF in small letters. how can i change this
> meta-inf to META-INF?