ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 6246] New: - Better build.xml example.
Date Tue, 05 Feb 2002 13:18:00 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=6246>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=6246

Better build.xml example.

           Summary: Better build.xml example.
           Product: Ant
           Version: 1.4.1
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Enhancement
          Priority: Other
         Component: Documentation
        AssignedTo: ant-dev@jakarta.apache.org
        ReportedBy: ramsdell@mitre.org


Let me suggest that you replace the example build.xml in the documentation
with the one enclosed.  I have found it to be very useful.

John

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

<!-- set global properties for this build -->
<property name="proj" value="PROJECT"/>
<property name="pkgs" value="PROJECT-PACKAGES"/>

<!-- usually, no changes are needed below this line -->
<property name="srczip" value="src.zip"/>
<!-- directory names -->
<property name="docs" value="docs"/>
<property name="build" value="build"/>
<property name="dist" value="dist"/>
<property name="api" value="api"/>

<target name="init">
<!-- Create the time stamp -->
<tstamp/>
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build}"/>
</target>

<target name="compile" depends="init">
<!-- Compile the java code from . into ${build} -->
<javac srcdir="." destdir="${build}"/>
</target>

<target name="resource" depends="init">
<!-- Copy resources from . into ${build} -->
<copy todir="${build}">
  <fileset dir=".">
    <exclude name="${docs}/"/>
    <exclude name="${build}/"/>
    <exclude name="${dist}/"/>
    <exclude name="${api}/"/>
    <include name="**/*.properties"/>
    <include name="**/*.png"/> 
    <include name="**/*.gif"/> 
    <include name="**/*COPYING"/>
  </fileset>
</copy>
</target>

<target name="all" depends="compile,resource">
<!-- Put everything in ${build} into the ${proj}.jar file -->
<jar jarfile="${proj}.jar" manifest="${proj}.mf" basedir="${build}"/>
</target>

<target name="source" depends="init">
<zip zipfile="${srczip}">
  <fileset dir=".">
    <exclude name="${build}/"/>
    <exclude name="${proj}.jar"/>
    <exclude name="*.zip"/>
    <exclude name="${dist}/"/>
    <exclude name="${api}/"/>
  </fileset>
</zip>
</target>

<target name="dist" depends="all,source">
<mkdir dir="${dist}/${proj}"/>
<copy todir="${dist}/${proj}">
  <fileset dir=".">
    <include name="${proj}.jar"/>
    <include name="${proj}.sh"/>
    <include name="${docs}/"/>
    <include name="${srczip}"/>
  </fileset>
</copy>
<zip zipfile="${proj}-${DSTAMP}.zip" basedir="${dist}"/>
</target>

<target name="doc">
<mkdir dir="${api}"/>
<javadoc sourcepath="." packagenames="${pkgs}" destdir="${api}"/>
</target>

<target name="clean">
<!-- Delete the ${build} directory, the project jar file, -->
<!-- the source zip file, and the ${dist} and ${api} directories -->
<delete dir="${build}"/>
<delete file="${proj}.jar"/>
<delete file="${srczip}"/>
<delete dir="${dist}"/>
<delete dir="${api}"/>
</target>
</project>

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message