You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by cr...@locus.apache.org on 2000/04/05 00:01:14 UTC
cvs commit: jakarta-tomcat/src/doc/appdev/sample build.bat build build.xml
craigmcc 00/04/04 15:01:14
Modified: src/doc/appdev build.xml.txt
src/doc/appdev/sample build build.xml
Added: src/doc/appdev/sample build.bat
Log:
Revise for current "best practices" build.xml design.
Add a "build.bat" script for the sample application, and update the
Unix one to correctly pass the initialization for the tomcat.home
property.
Revision Changes Path
1.5 +19 -28 jakarta-tomcat/src/doc/appdev/build.xml.txt
Index: build.xml.txt
===================================================================
RCS file: /home/cvs/jakarta-tomcat/src/doc/appdev/build.xml.txt,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- build.xml.txt 2000/04/01 14:43:07 1.4
+++ build.xml.txt 2000/04/04 22:01:12 1.5
@@ -10,24 +10,18 @@
<project name="My Project" default="compile" basedir=".">
-<!-- The "init" target is executed when Ant is first started, to initialize
- the values of properties (or perform other setup tasks as needed).
- In current versions of Ant, this behavior is hard coded - in future
- versions, the 'init="init"' attribute added to each other target will
- request this behavior with no further changes required.
-
- The most common use of the "init" target is to define properties,
- whose names can be used later in the build process. The advantage
- of using properties is that you can change the property value in a
- single place, and all affected tasks will be automatically updated.
+<!-- Property Definitions
Each of the following properties are used by convention in this
build file. The values specified can be overridden at run time by
- defining a Java system property with the same name as this property.
+ adding a "-Dname=value" argument to the command line that invokes Ant.
This technique is normally used to copy the values of the ANT_HOME
and TOMCAT_HOME environment variables into the "ant.home" and
"tomcat.home" properties, which are normally not defined explicitly.
+ app.name Base name of this application, used to
+ construct filenames and directories.
+
deploy.home The name of the directory into which the
deployment hierarchy will be created.
Normally, this will be the name of a
@@ -60,15 +54,12 @@
http://localhost:8080/myapp
-->
- <target name="init">
- <!-- Property values defined here can be overridden by defining
- corresponding Java system properties on the Ant command line. -->
- <property name="deploy.home" value="${tomcat.home}/webapps/myapp"/>
- <property name="dist.home" value="${deploy.home}"/>
- <property name="dist.src" value="myapp.jar"/>
- <property name="dist.war" value="myapp.war"/>
- <property name="javadoc.home" value="${deploy.home}/javadoc"/>
- </target>
+ <property name="app.name" value="myapp"/>
+ <property name="deploy.home" value="${tomcat.home}/webapps/${app.name}"/>
+ <property name="dist.home" value="${deploy.home}"/>
+ <property name="dist.src" value="${app.name}.jar"/>
+ <property name="dist.war" value="${app.name}.war"/>
+ <property name="javadoc.home" value="${deploy.home}/javadoc"/>
<!-- The "prepare" target is used to construct the deployment home
@@ -78,7 +69,7 @@
hierarchy, and set up the WEB-INF subdirectory appropriately.
-->
- <target name="prepare" init="init">
+ <target name="prepare">
<mkdir dir="${deploy.home}"/>
<copydir src="web" dest="${deploy.home}"/>
<mkdir dir="${deploy.home}/WEB-INF"/>
@@ -95,7 +86,7 @@
to compile everything from scratch.
-->
- <target name="clean" init="init">
+ <target name="clean">
<deltree dir="${deploy.home}"/>
</target>
@@ -119,7 +110,7 @@
home directory structure will be created if needed the first time.
-->
- <target name="compile" depends="prepare" init="init">
+ <target name="compile" depends="prepare">
<javac srcdir="src" destdir="${deploy.home}/WEB-INF/classes"
classpath="${deploy.home}/WEB-INF/classes"
debug="on" optimize="off" deprecation="off"/>
@@ -134,7 +125,7 @@
the deployment home directory.
-->
- <target name="javadoc" depends="prepare" init="init">
+ <target name="javadoc" depends="prepare">
<!-- TODO -->
</target>
@@ -144,7 +135,7 @@
source code instead of just the files that have been changed.
-->
- <target name="all" depends="clean,prepare,compile,javadoc" init="init"/>
+ <target name="all" depends="clean,prepare,compile,javadoc"/>
<!-- The "dist" target builds the distribution Web ARchive (WAR) file
@@ -154,11 +145,11 @@
that separately.
-->
- <target name="dist" depends="prepare,compile" init="init">
+ <target name="dist" depends="prepare,compile">
<jar jarfile="${dist.home}/${dist.src}"
- basedir="." items="*"/>
+ basedir="."/>
<jar jarfile="${dist.home}/${dist.war}"
- basedir="${deploy.home}" items="*"/>
+ basedir="${deploy.home}"/>
</target>
1.2 +3 -3 jakarta-tomcat/src/doc/appdev/sample/build
Index: build
===================================================================
RCS file: /home/cvs/jakarta-tomcat/src/doc/appdev/sample/build,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- build 2000/03/28 02:36:21 1.1
+++ build 2000/04/04 22:01:13 1.2
@@ -1,6 +1,6 @@
#!/bin/sh
# build -- Build Script for the "Hello, World" Application
-# $Id: build,v 1.1 2000/03/28 02:36:21 craigmcc Exp $
+# $Id: build,v 1.2 2000/04/04 22:01:13 craigmcc Exp $
# Identify the custom class path components we need
CP=$TOMCAT_HOME/classes:$TOMCAT_HOME/lib/ant.jar:$TOMCAT_HOME/lib/xml.jar
@@ -8,5 +8,5 @@
CP=$CP:$TOMCAT_HOME/lib/webserver.jar
# Execute ANT to perform the requested build target
-java -Dtomcat.home=$TOMCAT_HOME -classpath $CP:$CLASSPATH \
- org.apache.tools.ant.Main "$@"
+java -classpath $CP:$CLASSPATH org.apache.tools.ant.Main \
+ -Dtomcat.home=$TOMCAT_HOME "$@"
1.2 +7 -11 jakarta-tomcat/src/doc/appdev/sample/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/jakarta-tomcat/src/doc/appdev/sample/build.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- build.xml 2000/03/28 02:36:21 1.1
+++ build.xml 2000/04/04 22:01:13 1.2
@@ -4,22 +4,18 @@
the recommendations in the Application Developer's Guide.
NOTE: Before using this file as is, you should review the
- values for the properties described under the "init" target.
+ values for the properties that are defined below.
In particular, it is assumed that you wish to install this
application under context path "/myapp" in the Tomcat installation
defined by your TOMCAT_HOME environment variable.
-->
-
- <target name="init">
- <!-- Property values defined here can be overridden by defining
- corresponding Java system properties on the Ant command line. -->
- <property name="deploy.home" value="${tomcat.home}/webapps/myapp"/>
- <property name="dist.home" value="${deploy.home}"/>
- <property name="dist.src" value="myapp.jar"/>
- <property name="dist.war" value="myapp.war"/>
- <property name="javadoc.home" value="${deploy.home}/javadoc"/>
- </target>
+ <property name="app.name" value="myapp"
+ <property name="deploy.home" value="${tomcat.home}/webapps/${app.name}"/>
+ <property name="dist.home" value="${deploy.home}"/>
+ <property name="dist.src" value="${app.name}.jar"/>
+ <property name="dist.war" value="${app.name}.war"/>
+ <property name="javadoc.home" value="${deploy.home}/javadoc"/>
<target name="prepare" init="init">
1.1 jakarta-tomcat/src/doc/appdev/sample/build.bat
Index: build.bat
===================================================================
@echo off
rem build.bat -- Build Script for the "Hello, World" Application
rem $Id: build.bat,v 1.1 2000/04/04 22:01:13 craigmcc Exp $
if %CLASSPATH% == "" goto noclasspath
:haveclasspath
set _CLASSPATH=%CLASSPATH%
set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME\classes
goto restofclasspath
:noclasspath
set _CLASSPATH=
set CLASSPATH=%TOMCAT_HOME%\classes
:restofclasspath
set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME%\lib\ant.jar
set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME%\lib\jasper.jar
set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME%\lib\servlet.jar
set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME%\lib\webserver.jar
set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME%\lib\xml.jar
rem Execute ANT to perform the requested build target
java org.apache.tools.ant.Main -Dtomcat.home=%TOMCAT_HOME% %1 %2 %3 %4 %5 %6 %7 %8 %9
set CLASSPATH=%_CLASSPATH%
set _CLASSPATH=