ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject Ant 1.5.1 -- build.sysclasspath question
Date Tue, 03 Dec 2002 10:57:52 GMT
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
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
indicate the AntClassLoader to reload/refresh it's libraries in attention to
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 dir="../lib">
      <include name="*.jar"/>
  <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">
   <classpath><path refid="classpath.compile"/></classpath>
  <jar jarfile="${web-inf-lib}/${project}.jar" basedir="${classes}"
compress="false" />

  <target name="junittest" depends="init,compile">
  <junit printsummary="on"
    <pathelement path="${classpath.compile}${path.separator}${classpath}"/>
   <jvmarg value="-Djava.compiler=NONE"/>
   <formatter type="plain"/>
   <batchtest todir="${testout}">
    <fileset dir="${src}">
     <include name="${unittest-includes}" />

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message