ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Meinolf.Schulte-Doeingh...@Bertelsmann.de
Subject Ant 1.5.1 -- build.sysclasspath question
Date Tue, 03 Dec 2002 10:57:52 GMT
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
View raw message