sourcepath switch for javac from ant

From: Thufir (thufir.hawat_at_mail.com)
Date: 01/31/05

  • Next message: Paul Chapman: "Re: "call to super must be first statement in constructor""
    Date: 31 Jan 2005 00:33:48 -0800
    
    

    I'm trying to invoke "javac" with the sourcepath switch so that
    Tidy.jar can be used as a package. There might be a problem with how
    the property's are declared, perhaps?

    C:\>
    C:\>ant
    Buildfile: build.xml

    BUILD FAILED
    C:\build.xml:23: Element type "javac" must be followed by either
    attribute spe
    cifications, ">" or "/>".

    Total time: 0 seconds
    C:\>type build.xml
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <project name="JTidy" default="package">

    <property name="outputDir"
    value="C:\java\classes\" />
    <property name="sourceDir"
    value="C:\java\sources\atreides\jtidy\" />
    <property name="sourceDir2"
    value="C:\java\sources\org\w3c\tidy\Tidy.jar" />
    <property name="mainClass"
    value="TidyTest" />

    <target name="clean">
    <delete dir="${outputDir}" />
    </target>

    <target name="prepare" depends="clean">
    <mkdir dir="${outputDir}" />
    </target>

    <target name="compile" depends="prepare">
    <javac
    <sourcepath>
    srcdir="${sourceDir}"
    srcdir2="${sourceDir2}"
    </sourcepath>
    <classpath>
    destdir="${outputDir}" />
    </classpath>
    </target>

    <target name="manifest" depends="compile">
    <manifest file="${outputDir}/MANIFEST.MF">
    <attribute name="Main-Class"
    value="atreides.monsters.${mainClass}" />
    </manifest>
    </target>

    <target name="package" depends="manifest">
    <jar jarfile="${outputDir}/${mainClass}.jar"
    basedir="${outputDir}"
    manifest="${outputDir}/MANIFEST.MF" />
    </target>

    </project>

    C:\>

    I'm trying to use the following as a template:

    <target ... >
    <javac ...>
    <classpath>
    <pathelement location="lib/"/>
    <pathelement path="${java.class.path}/"/>
    <pathelement path="${additional.path}"/>
    </classpath>
    </javac>
    </target>
    </project>

    from <http://ant.apache.org/manual/using.html#references>
    Thanks,

    Thufir Hawat


  • Next message: Paul Chapman: "Re: "call to super must be first statement in constructor""

    Relevant Pages

    • Re: How to include *.class file with package in CLASSPATH?
      ... myclass.java contains the following package information: ... then the compiler complains that he cannot find myclass: ... Try just compiling without setting any classpath, or, if your classpath ... contains specific settings try: javac -cp .;%CLASSPATH test.java ...
      (comp.lang.java.help)
    • Re: package junit.framework does not exist
      ... not find the junit package. ... From Eclipse, the project compile fine, but from the command line, I ... I have included junit.jar in the classpath, ...
      (comp.lang.java.programmer)
    • Re: how to compile servlets in JEE 5 SDK
      ... using 'javac', it gives the error that javax.servlet package does not ... I have tried by adding path of j2ee.jar file in classpath ... Should i need to install JSDK or jee 5 sdk can compile ...
      (comp.lang.java.programmer)
    • Re: How to include *.class file with package in CLASSPATH?
      ... myclass.java contains the following package information: ... then the compiler complains that he cannot find myclass: ... contains specific settings try: javac -cp .;%CLASSPATH test.java ... CLASSPATH is a blunt tool. ...
      (comp.lang.java.help)
    • javac and java -classpath with regards to ant
      ... javac. ... "The class path tells the JDK tools and applications ... Tidy.jar would be in the classpath. ... And that's what I want ant to do, ...
      (comp.lang.java.help)