ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject RE: How to map JBuilder settings in Ant syntax
Date Fri, 25 Jul 2003 10:05:40 GMT
Interesting thing :-)

I created a buildfile which will do that work.
- xmltask libarary from
- ant-contrib library from

- extract the information which libarary are used from the jbuilder project
file (JPX)
- iterate over all used library files (*.library)
  !!! the library file must have the <nameInJPX>.library filename !!!
- extract the class path information and collect that
- transform that collected infos to a semicolon separated list
- create a <path> with that

But there is still a problem: JBuilder allows to define a path INSIDE an
archive. E.g.
This is not handled by this script. But maybe there will be no problems with

<?xml version="1.0" encoding="ISO-8859-1"?>
<project name="test" basedir="." default="main">

    <!-- import the ant libraries -->
    <taskdef resource="net/sf/antcontrib/"/>
    <taskdef name="xmltask"

    <!-- the jbuilder project file to analyze -->
    <property name="jbx.file" value="SZV.jpx"/>

    <target name="main" description="Create a classpath from JBuilder
project file">
        <!-- extract the used libraries from the JPX file and load that as
ant property -->
        <property name="tmp" value="tmp.xml"/>
        <xmltask source="${jbx.file}">
        <xmltask dest="${tmp}">
            <insert path="/" buffer="usedlibs"/>
        <xmlproperty file="${tmp}" />
        <delete file="${tmp}"/>

        <echo>all included libraries are:  ${property(value)}</echo>

        <!-- iterate over the used library files and extract their classpath
        <foreach target="processLibFile" param="libfile"
list="${property(value)}" delimiter=";"/>

        <!-- store the result in a new xml file -->
        <xmltask dest="${tmp}">
            <insert path="/"><![CDATA[ <root/> ]]></insert>
            <insert path="/root" buffer="libs.classpath"/>

        <!-- change to intermediate format -->
        <replace file="${tmp}">
            <replacefilter token="["/>
            <replacefilter token="]"/>
            <replacefilter token="&lt;path&gt;"/>
            <replacefilter token="&lt;/path&gt;" value=";"/>
            <replacefilter token="${line.separator}"/>

        <!-- read the input -->
        <loadfile property="file" srcFile="${tmp}"/>

        <delete file="${tmp}"/>

        <!-- extract the values to a valid path -->
        <propertyregex property="pathvalue" input="${file}"
regexp="&lt;root&gt;(.*)&lt;/root&gt;" select="\1"/>

        <!-- create a <path> element -->
        <path id="path">
            <path path="${pathvalue}"/>

        <!-- use the created path -->
        <pathconvert property="path.win32" refid="path" targetos="windows"/>
        <echo>path.win32: ${path.win32}</echo>

    <!-- Extract the classpath from one library file -->
    <target name="processLibFile" if="libfile">
        <xmltask source="${libfile}.library">
            <copy path="/library/class/path" buffer="libs.classpath"


With short tests on my computer that works ...


> -----Original Message-----
> From: Gian Franco Casula []
> Sent: Thursday, July 24, 2003 1:44 PM
> To:
> Subject: How to map JBuilder settings in Ant syntax
> Hello,
> Does anyone know how to translate the entries in
> 'Required libraries' in the JBuilder 'Project properties'
> in my build.xml?
> Example: in JBuilder I have the 'Required library' called 'mail'
> (which consists of two jar files) it's content is used by JBuilder
> during compilation. Since I haven't 'included' this library in my
> build.xml a compilation error occurs, which I only manage to
> skip by deleting the class referencing the 'mail' files.
> Thank you,
> Gian Franco

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