ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steph Richardson" <st...@kvasar.com>
Subject RE: build.xml
Date Fri, 14 Nov 2003 22:45:32 GMT
If you haven't got everyone up to ant 1.6 yet ( for the import task ) you can use standard
xml External entity includes, to include
fragments of a build file.
I use something like this a lot :

<!DOCTYPE project [
  <!ENTITY commonTargets SYSTEM "../../common/targets.xml">
]>

<project name="webapp" default="all" basedir=".">

  	<!-- set global properties for this build -->
	<property name="rootdir" value=".."/>
	<property name="deploy" value="${rootdir}/../deploy"/>
	<property file="${user.home}/build.properties" />
	<property file="../../common/default.properties" />

	&commonTargets; <!-- The ant targets are in ../../common/targets.xml -->


etc...





> -----Original Message-----
> From: Conelly, Luis (EM, DDEMESIS) [mailto:Luis.Conelly@ge.com]
> Sent: Friday, November 14, 2003 4:45 PM
> To: Ant Users List (E-mail)
> Subject: build.xml
>
>
> Hi all
>
> 	This is probably more a XML question than an Ant question; however somebody might know
how to do it:
>
> 	I have this huge build.xml file with 800+ script lines. This has become quite a bit
annoying to maintain. Then I'd
> like to modularize the script into several files, to make easier the maintenance (properties
in one file, build tasks in
> other, update tasks located in some other file and so on)
>
> 	However, I am not pretty sure if I am allowed to "include" xml files into one master.xml
file. I have done as follows:
>
> common-properties.xml file
> -----------------------------------------
> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
>     <properties>
> 	<property environment="env"/>
>     	<property name="src" location="src"/>
>     	<property name="dest.home" location="../xxx_yyy"/>
>     	<property name="build" location="${dest.home}/classes"/>
>     	<property name="jsp.home" location="${dest.home}/jsp"/>
>     	<property name="dist" location="${dest.home}/dist"/>
>     	<property name="classpath" location="${env.CLASSPATH}"/>
>     </properties>
>
>
> master.xml
> -----------------------------------------
> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
>     <project name="common-props" default="init">
>         <include file="common-properties.xml"/> <!-- prior file-->
> 	<target name="init">
>             <echo message="${env.CLASSPATH}"/>
>         </target>
>     </project>
>
>
> 	However, when I try to execute the 'init' target, I got following error:
>
> C:\Projects\GNF\eDocs>ant -f master.xml init
> Buildfile: master.xml
>
> BUILD FAILED
> file:C:/Projects/master.xml:3: Unexpected element "include"
>
> 	I have seen this kind of 'include' in some other build files, but I am not pretty sure
if this is the right way to do it.
>
> 	Any help / observation / indication will be appreciated
>
> 	Regards
> 	Luis
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message