I did a quick hack in java and created a small ant buildfile to compile and
jar the program.
No package structure and no directory structure (really a quick hack :-)
When I was <jar>ing it with 
        <jar destfile="PrintArgs.jar" includes="*.class" />
the jar doesn´t contain the class.
If I work with filesets OR if I set the basedir attribute it works.

Bug in JarTask or in Doc? The doc sais that basedir isn´t required (although
the first example uses it).

I made a small test scenario:


---8-<-------8-<-------8-<-------8-<-------8-<-------8-<-------8-<-------8-<
-------8-<-------8-<----
public class PrintArgs {
    public static void main(String[] args) {
        System.out.println("parameters are:");
        for (int i=0; i<args.length; i++) {
            System.out.println(i + ": " + args[i]);
        }
        System.out.println();
    }
}
---8-<-------8-<-------8-<-------8-<-------8-<-------8-<-------8-<-------8-<
-------8-<-------8-<----
<?xml version="1.0" encoding="ISO-8859-1"?>

<project default="jar">

    <target name="compile">
        <javac srcdir="." destdir="." />
    </target>

    <target name="jar" depends="compile">
        <!-- Delete the jars so that I can do this more times -->
        <delete><fileset dir="."><include name="*.jar"/></fileset></delete>

        <!-- Jar does not contain the class -->
        <!-- Maybe basedir isn´t right? See next -->
        <jar destfile="PrintArgs.jar" includes="*.class" />

        <!-- This works -->
        <jar destfile="PrintArgs2.jar" basedir="." includes="*.class" />

        <!-- And this works, too -->
        <jar destfile="PrintArgs3.jar">
            <fileset dir=".">
                <include name="*.class"/>
            </fileset>
        </jar>
    </target>

</project>
---8-<-------8-<-------8-<-------8-<-------8-<-------8-<-------8-<-------8-<
-------8-<-------8-<----


Jan Matèrne

<<application/ms-tnef>>

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to