ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jacob Kjome <h...@visi.com>
Subject Re: Ant 1.5.1 -- build.sysclasspath question
Date Tue, 03 Dec 2002 14:18:55 GMT

This is a different issue.  Since the optional.jar contains the junit 
taskdef, the JUnit.jar needs to be in the same classloader.  Putting 
Junit.jar in ANT_HOME/lib will do the trick.  Otherwise, you can put 
optional.jar inside your project along with Junit.jar, but you will have to 
define the taskdefs like you do for any custom taskdef in that case.

The easiest solution, by far, is to just bite the bullet and put JUnit.jar 
in ANT_HOME/lib

Jake

At 11:57 AM 12/3/2002 +0100, you wrote:
>Hi,
>I'm using ant 1.5.1. and tried to set the system classpath dynamically
>during build time.
>To do so I set the build.sysclasspath to "last" and add a pathelement
>to the project level.
>In addition I tried to set the "java.class.path" with a property tag in an
>init task, but at the end I get the following error message for the javac
>and the junit tasks:
>
>"Unable to find a javac compiler"
>"Could not create task or type of type: junit."
>
>This is because ant couldn't find the junit libraries in the system
>classpath
>as well as the tools.jar for javac,
>but as I understand by using the build.sysclasspath flag I should have the
>possibility to set classpath during runtime like this
>
><property name="java.class.path"    refid="classpath.path" />
>
>but it does not take effect to the classloader !??
>
>Is there a possibility to overwrite the "java.class.path" during runtime and
>to
>indicate the AntClassLoader to reload/refresh it's libraries in attention to
>the
>new java.class.path?
>
>
>Thanks for your help
>Meinolf Schulte-Döinghaus
>
>
><?xml version="1.0" encoding="UTF-8"?>
><project name="monitoring" default="test">
>   <property name="build.sysclasspath"              value="last" />
>
>   <path id="classpath.path">
>     <pathelement location="../build/classes"/>
>     <fileset dir="../compilelib">
>       <include name="*.jar"/>
>     </fileset>
>     <fileset dir="../lib">
>       <include name="*.jar"/>
>     </fileset>
>   </path>
>
>
>   <target name="init">
>     <property name="classpath"          refid="classpath.path" />
>     <property name="classpath.compile"  refid="classpath.compile" />
>
>     <property name="classpath.path"     refid="classpath.path" />
>     <property name="java.class.path"    refid="classpath.path" />
>     .
>     .
>     .
>     .
>
>
>
>   <target name="compile" depends="init,copyprops">
>   <javac
>    srcdir="${src}"
>    destdir="${classes}"
>    deprecation="on"
>    debug="on">
>    <classpath><path refid="classpath.compile"/></classpath>
>   </javac>
>   <jar jarfile="${web-inf-lib}/${project}.jar" basedir="${classes}"
>compress="false" />
>   </target>
>
>
>   <target name="junittest" depends="init,compile">
>   <junit printsummary="on"
>          fork="yes"
>          failureproperty="testfailed">
>    <classpath>
>     <pathelement path="${classpath.compile}${path.separator}${classpath}"/>
>    </classpath>
>    <jvmarg value="-Djava.compiler=NONE"/>
>    <formatter type="plain"/>
>    <batchtest todir="${testout}">
>     <fileset dir="${src}">
>      <include name="${unittest-includes}" />
>     </fileset>
>    </batchtest>
>   </junit>
>   </target>
>
>--
>To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
>For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message