ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matthew Inger <>
Subject Re: newbie
Date Thu, 18 Oct 2001 20:59:49 GMT
i am skeptical about your claim that ant does not put
.class files into a .jar that it does not build.  I build
many jar files with ant that have objects not produced
as a result of an ant operation.  Try explicitly
referring to your class files in the jar command.
You're probably better off using a fileset rather
than explicitly building one:

<jar jarfile="/path/to/jar/file.jar">

  <fileset dir="./classoutput">
    <include="**/*.class" />

  <fileset dir="/MYCOMP/PIJAVA/CENTER/java">
    <include name="sun/server/**/*.class" />
    <include name="org/**/*.class" />
    <include name="com/sun/xml/**/*.class" />
    <include name="com/cps/util/**/*.class" />
    <include name="com/cps/CVE/**/*.class" />

On Thu, 2001-10-18 at 17:34, Winston Finnick wrote:
> Don't ya luv reading that in the subject.  I'm using ant to build a
> project and jar the files together.  That works great.  I then need to add
> pre-existing .class files to the jar file that was created earlier.  Ant
> does not seem to add the .class files that it does not build.  So I
> accomplished that with the exec tag.  It adds them just fine however it
> adds the full path in the jar file rather than from the build directory.
> Here is a bit of my build.xml...
> <target name="myjar.jar" depends="compile">
>     <jar jarfile="myjar.jar"
>          basedir="./classoutput" excludes="./*"/>
>     <exec dir="D:\jdk1.3\bin" executable="jar.exe" os="Windows 2000">
> 		<arg line="uf
> \MYCOMP\PIJAVA\CENTER\java\myjar.jar
> \MYCOMP\PIJAVA\CENTER\java\com\sun\server\
> \MYCOMP\PIJAVA\CENTER\java\com\sun\xml\
> \MYCOMP\PIJAVA\CENTER\java\com\cps\util\
> \MYCOMP\PIJAVA\CENTER\java\com\cps\CVE\"/>
>     </exec>
> </target>
> I have to use the \MYCOMP\PIJAV........ path or else it tells me no such
> directory.  My question is is there another way to jar (add) pre-existing
> .class files that ant does not build but are there with all of the other
> .java and .class files and have them retain there build paths? ie
> com\cps\CVE\existingclass.class and not
> D:\MYCOMP\PIJAVA\CENTER\java\cps\CVE\existingclass.class.  I also
> tried the includesfile tag and could not get any .class files to be
> included. Thanks for any help.  I apoligize if it's something stupid.
> Winston
Matt Inger (
Sedona Corporation
455 S. Gulph Road, Suite 300
King of Prussia, PA 19406
(484) 679-2213
"Self-respect - the secure feeling that no one,
 as yet, is suspicious." -H.L. Mencken 

View raw message