ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Markus Niedermann <markus.niederm...@cerberus.ch>
Subject Re: Inheritance question
Date Thu, 18 Jul 2002 15:18:19 GMT
Ok, here an example:

1. Create all files in the same directory and call ant.
   ${basedir}/master.properties points to the wellknown directory...
2. Copy master.xml and master.properties to a different directory
   and change the property in build xml. e.g. 
${basedir}/../masterscripts/master.properties
   and master.properties. e.g. ${basedir}/../masterscripts/master.xml

The build.xml calls the master.xml ;-)

build.xml:
<project name="module" default="compile">
    <property file="${basedir}/master.properties"/>
    <property name="text"    value="cool"/>
    <property name="module.build"    value="${basedir}/build"/>
    <target name="compile">
        <echo message="forward compile task:"/>
        <ant antfile="${master.antscript}" target="compile"/>
    </target>
</project>

master.xml:
<project name="master-script" default="compile">
    <target name="compile">
        <echo message="Masterscript at work:"/>
        <echo message="Java is a ${text} language!"/>
        <echo message="The output dir is: ${module.build}"/>
    </target>
</project>

master.properties:
master.antscript=${basedir}/master.xml


Markus

Ori Burstein wrote:

>Thanks Markus,
>I did most of those recommendation,
>I'm having many build.xml files in my src tree,
>and currently my build runs then one by one, this way I create build (this
>is the simplistic description of the build)
>but one thing is still not clear to me:
>I would like to simplify the build.xml files and to remove from them all the
>common targets, pathes,properties, so they will inherit them from one
>master.xml, and not creating a master.xml which executes them all.
>Is it possible? or I just didn't understand this part? Are there more
>"import" possibility for importing those components (like importing
>properties using the property task)?
>Thanks,
>Ori.
>
>
>
>-----Original Message-----
>From: Markus Niedermann [mailto:markus.niedermann@cerberus.ch]
>Sent: Thu, July 18, 2002 4:09 PM
>To: Ant Users List
>Subject: Re: Inheritance question
>
>
>Hi Ori
>
>My tips:
>1. Define a common project structure like
>
>   workspace
>    +-- module1
>    |    +-- build            (class files)
>    |    +-- src              (source files)
>    |         +-- com ...
>    +-- module2
>    ...
>    (like CVS ;-)
>
>2. Design your build system based on this structure
>3. Do not define relative path properties (always use ${basedir}/xy/...)
>4. Create for each module a build.xml (like the user interface)
>5. Call from the module build.xml the master.xml with the common
>functionality (<ant>...)
>6. Inherit your properties => the master.xml works with module data...
>7. The master.xml is located in a well known module (configured in the
>build.xml)
>8. You can define core functionality in the master.xml,
>   and overwrite special behaviour in the build.xml (that's cool and a
>must...)
>9. You can force master.properties by <property file="... at the top of
>   the build.xml
>
>- The build.xml acts like an facade to the master.xml
>- You can use the build.xml as usual
>- It works fine!
>
>Markus
>
>Ori Burstein wrote:
>
>  
>
>>Hi,
>>I have used the Ant for a while and I have question I would like to be
>>advised about:
>>I'm trying to create a build using many ant files which will reuse some
>>tasks ( like targets, path, properties), and I would like to "share" those
>>tasks in one file, which all the ant files will inherit from.
>>Please advise me if this can be done, and how?
>>
>>Thanks,
>>Ori.
>>
>>
>>--
>>To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
>>For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>
>>
>>
>>
>>    
>>
>
>
>
>--
>To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
>For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>
>
>
>--
>To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
>For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>
>
>  
>



--
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