Item 1:

I was building commons-configuration from scratch and it was having problems
retrieving some of the jar files from ibiblio. I made fixes to the build.xml
file to add/modify some lines to get it to work. My fixed build.xml is
attached.


Item 2:

The ClassPropertiesConfiguration seems to only be able to load properties
files from within the package of the class passed into the constructor. I
have been unable to successfully load a properties file from the root of the
classpath by placing a "/" at the beginning of the name (as the source code
indicates one should do). The source code indicates that the Javadoc for
loading resources says that all URL's start with a "/", but I am unable to
find that in the javadoc for ClassLoader and in testing I have been unable
to get ClassLoader to load a file that beings with a "/".

If I am correct, I propose that ClassPropertiesConfiguration be changed as
described below. In my experience it is more likely that properties files
need to be loaded from the root of the classpath then from a specific
package within the classpath (but that is my experience).

Use the classloader of class that is provided by the constructor.
Add a constructor that indicates whether to use relative or absolute.
Change getPropertyStream to utilize the relative or absolute flag.
Add a test case that checks that absolute paths work.

I will gladly submit a patch to do the above if what I propose makes sense.

Brian Dunbar
<?xml version="1.0" encoding="UTF-8"?>

<!-- ===================================================================== -->
<!--                                                                       -->
<!-- $Id: build.xml,v 1.10 2003/01/14 03:53:12 dlr Exp $ -->
<!--                                                                       -->
<!-- ===================================================================== -->

<project default="jar" name="commons-configuration" basedir=".">

  <property name="defaulttargetdir" value="target"/>
  <property name="classesdir" value="target/classes"/>
  <property name="testclassesdir" value="target/test-classes"/>
  <property name="testreportdir" value="target/test-reports"/>
  <property name="distdir" value="dist"/>
  <property name="javadocdir" value="target/docs/apidocs"/>
  <property name="final.name" value="commons-configuration-0.8.1"/>

  <target name="init" description="o Initializes some properties">
  <setproxy proxyhost="secfw4.sec.gov"/>

    <condition property="noget">
      <equals arg2="only" arg1="${build.sysclasspath}"></equals>
    </condition>
  </target>
    
  <target name="jar" description="o Create the jar" depends="get-deps">

    <mkdir dir="${classesdir}"></mkdir>

    <javac destdir="${classesdir}" deprecation="true" debug="true" optimize="false" excludes="**/package.html">
      <src>
        <pathelement location="src/java"></pathelement>
      </src>
      <classpath>
        <fileset dir="lib">
          <include name="*.jar"></include>
        </fileset>
      </classpath>
    </javac>

    
    <jar jarfile="target/${final.name}.jar" excludes="**/package.html" basedir="${classesdir}"></jar>

  </target>
  
  <target name="clean" description="o Clean up the generated directories">
    <delete dir="${defaulttargetdir}"></delete>
    <delete dir="${distdir}"></delete>
  </target>

  <target name="dist" description="o Create a distribution" depends="jar, javadoc">
    <mkdir dir="dist"></mkdir>
    <copy todir="dist">
      <fileset dir="${defaulttargetdir}"></fileset>
    </copy>
  </target>
 
  <target name="test" description="o Run the test cases" depends="compile-tests">
    <mkdir dir="${testreportdir}"></mkdir>
    <junit dir="./" printSummary="yes" fork="true" haltonerror="true">
      <sysproperty key="basedir" value="src/test"></sysproperty>
      <formatter type="xml"></formatter>
      <formatter usefile="true" type="plain"></formatter>
      <classpath>
        <fileset dir="lib">
          <include name="*.jar"></include>
        </fileset>
        <pathelement location="target/${final.name}.jar"></pathelement>
        <pathelement path="${testclassesdir}"></pathelement>
      </classpath>
      <batchtest todir="${testreportdir}">
        <fileset dir="src/test"
                 excludes="**/TestBasePropertiesConfiguration.java">
        </fileset>
      </batchtest>
    </junit>
  </target>

  <target name="compile-tests" depends="jar">
    <mkdir dir="${testclassesdir}"></mkdir>
    <javac destdir="${testclassesdir}" deprecation="true" debug="true" optimize="false" excludes="**/package.html">
      <src>
        <pathelement location="src/test"></pathelement>
      </src>
      <classpath>
        <fileset dir="lib">
          <include name="*.jar"></include>
        </fileset>
        <pathelement location="target/${final.name}.jar"></pathelement>
      </classpath>
    </javac>
 
    <copy todir="${testclassesdir}/org/apache/commons/configuration">
      <fileset dir="conf" includes="*.properties"/>
    </copy>
    
    <!-- To test the ability to load from the root of the classpath -->
    <copy todir="${testclassesdir}">
      <fileset dir="conf" includes="*.properties"/>
    </copy>
    
  </target>

  <target name="javadoc" description="o Generate javadoc" depends="jar">
 
 
    <mkdir dir="${javadocdir}"></mkdir>
 
    
    <tstamp>
      <format pattern="2001-yyyy" property="year"></format>
    </tstamp>
 
    <property name="copyright" value="Copyright &amp;copy;  Apache Software Foundation. All Rights Reserved."/>
 
    <property name="title" value="${final.name} API"/>
 
    <javadoc use="true" private="true" destdir="${javadocdir}" author="true" version="true" sourcepath="src/java" packagenames="org.apache.commons.configuration.*">
      <classpath>
        <fileset dir="lib">
          <include name="*.jar"></include>
        </fileset>
        <pathelement location="target/${final.name}.jar"></pathelement>
      </classpath>
    </javadoc>
 
  </target>

  <target name="get-deps" unless="noget" depends="init">
  
    <mkdir dir="lib"></mkdir>
    
    <get dest="lib/commons-collections-2.0.jar" usetimestamp="true" ignoreerrors="true" src="http://www.ibiblio.org/maven/commons-collections/jars/commons-collections-2.0.jar";></get>
    <get dest="lib/commons-logging-1.0.3.jar" usetimestamp="true" ignoreerrors="true" src="http://www.ibiblio.org/maven/commons-logging/jars/commons-logging-1.0.3.jar";></get>
    <get dest="lib/commons-digester-1.4.1.jar" usetimestamp="true" ignoreerrors="true" src="http://www.ibiblio.org/maven/commons-digester/jars/commons-digester-1.4.1.jar";></get>
    <get dest="lib/commons-lang-1.0.1.jar" usetimestamp="true" ignoreerrors="true" src="http://www.ibiblio.org/maven/commons-lang/jars/commons-lang-1.0.1.jar";></get>
    <get dest="lib/dom4j-1.3.jar" usetimestamp="true" ignoreerrors="true" src="http://www.ibiblio.org/maven/dom4j/jars/dom4j-1.3.jar";></get>
    <get dest="lib/junit-3.8.1.jar" usetimestamp="true" ignoreerrors="true" src="http://www.ibiblio.org/maven/junit/jars/junit-3.8.1.jar";></get>
    <get dest="lib/xerces-2.2.1.jar" usetimestamp="true" ignoreerrors="true" src="http://www.ibiblio.org/maven/xerces/jars/xerces-2.2.1.jar";></get>
    <get dest="lib/xmlParserAPIs-2.2.1.jar" usetimestamp="true" ignoreerrors="true" src="http://www.ibiblio.org/maven/xerces/jars/xmlParserAPIs-2.2.1.jar";></get>
  
  </target>

</project>
    

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

Reply via email to