----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, June 11, 2002 8:25 AM
Subject: Re: Proposal for Test and Samples Changes


> I mean, can you show me how you would embed a CLASSPATH path ref into the
> stubbed xml files, and how you would read that into the primary xml file?
> I would like to have a consistant classpath to reference across all of the
> xml files.
>
> Matt Seibert                                           [EMAIL PROTECTED]
> IBM        External:    (512) 838-3656      Internal:   678-3656
>

easy.

say we have a base directory, called ${masterbuild.dir}

in there we can have a subdir /include, containing our xml fragments

include/pathdefs.xml declares classpaths, here pulling in various librarries
and the base path.

  <path id="xdoclet.classpath">
    <pathelement location="${j2ee.jar}"/>
    <pathelement location="${jtidy.jar}"/>
    <pathelement location="${log4j.jar}"/>
    <pathelement location="${lucene.jar}"/>
    <pathelement location="${struts.jar}"/>
    <pathelement location="${xdoclet.jar}"/>
    <pathelement path="${java.class.path}"/>
  </path>

we can follow that in include/taskdefs.xml, with a use, or it can be used in
the file itself later on.

<taskdef name="document"
           classname="xdoclet.doc.DocumentDocletTask"
           classpathref="xdoclet.classpath"/>

The hard part in this world is getting all your references sorted out, which
is why we have to be rigorous about setting up property variables to point
to all the jars that get pulled in and dirs that get imported, and use
<property location="lib/junit.jar"> to have them all resolve properly.

The way I do this is

1. have the properties.xml work out where it is

  <property name="root.dir" location="${basedir}"/>
  <property name="masterbuild.dir" location="${root.dir}/.."/>
  <property file="${masterbuild.dir}/build.properties"/>

In a build file more than one level below the masterbuild dir, you have to
set
<property  name="masterbuild.dir" location="../.."/>
before including properties.xml, to resolve everything right.

My properties.xml is probably going to scare people off this process, as it
uses a properties file to let us control which versions of which libraries
get used in which sub project; that is powerful but complex. Simplest just
to name the jars


<property name="junit.jar" location="${masterbuild.dir}/junit.jar" />
<property name="jtidy.jar" location="${masterbuild.dir}/jtidy.jar" />
...etc.





Reply via email to