Streek Releases in Ant Application Builds
- Audience
- Purpose
- Prerequisites
-
Streek Releases in Ant Application Builds
- Overview
- Outline
- Add properties to top-level build file
- Add import tasks for necessary macrodefs
- Modify path elements
- Add target to obtain streek artifacts
- Modify source of uncompiled Streek artifacts
- Modify source of Streek JARs for inclusion in application WAR file
- Modify source of Streek and Third-Party JARs for inclusion in application EAR file
- Modify source of Streek and Third-Party JSP Tag libraries
- Modify source of Streek and Third-Party class libraries
- Modify package-appshutdown-sar task
- Add filters for configuration files
- Modifications to application.xml
- Modifications to web.xml
- Modifying a JSP build file for Streek releases
Audience
Application developers using Ant to build applications with Streek dependencies.
Purpose
To update Ant builds so that Streek dependencies are obtained from a checked-out (from CVS) copy of the maven-repo project, as JAR files of compiled classes, thus deprecating the prerequisite that application developers build the Streek project.
Prerequisites
- an up-to-date, local (checked out from CVS) copy of the maven-repo project
- some knowledge of Apache-Ant.
Streek Releases in Ant Application Builds
Overview
To retire dependencies on locally-built Streek classes & artifacts, as well as third-party JAR files previously warehoused in the CVS repository under ist-jxde/lib, application build files must be changed to accomplish the following:
- Modify references to ${streek.home}/target (and analogous references) so that the desired JAR and SAR files are obtained from maven-repo
- Modify other references to ${streek.home} so that uncompiled artifacts are obtained from versioned instances of streek-artifacts-misc-${version.number} in maven-repo
- Modify references to ${ist.jxde.home}/lib (and analogous references) so that the desired JAR files are obtained from maven-repo
- Modify references to imported or called ant targets, typically located in ${ist.jxde.home}/antlib, so that they refer to targets that are themselves modified to obtain dependencies from maven-repo instead of ${streek.home} or ${ist.jxde.home}/lib
Cf. Prerequisites, above.
Outline
Changes to Ant build scripts necessary to effect a change from using locally-built Streek classes and/or depracated third-party repository located in ist-jxde/lib, several categories of changes are required. Examples of such changes form the bulk of this document. The categories are:
- Modification of properties, as described here
- Addition or modification tasks that import macrodef scripts, as described here
- Modify path elements, as described here
- Add a target to obtain miscellaneous uncompiled Streek artifacts, as described here
- Modify references to miscellaneous uncompiled Streek artifacts, as described here
- Modify references to compiled Streek elements and TLD files, as described for WAR file JARs here and here; EAR file JARs; and JSP Tag Libraries
- Modify the task that packages the appshutdown SAR file, as described here
- Add filters to copy tasks for selected deployment descriptors, as described here
- Modify references in deployment descriptor application.xml, as described here
- Modify references in deployment descriptor web.xml, as described here
- Modify subsidiary build files; for example, modify a JSP build file, as described here
Add properties to top-level build file
Add the following properties to the applications top level build.xml.
- <property name="maven.repo.home" value="${cvs.home}/maven-repo" />
- This is the directory to which the local maven repository project is checked out.
- <property name="default.streek.version" value="3.9.0" />
- This is the version number for the streek build you wish to use (note that 3.9.0 is the appropriate version number for applications being compiled/run under Java 1.4.x.)
Add import tasks for necessary macrodefs
Add the following import task to the top-level build file, (as a child of the <project> element, i.e., not in any target):
<import file="${ist.jxde.home}/antlib/unpack-streek-misc.macrodef" />
Modify path elements
Ant path-like structures that reference Streek build artifacts such as streek.client.path, or third-party libraries in ${ist.jxde.home}/lib such as project.path, must now reference the versioned artifacts in maven-repo rather than local build artifacts in ${streek.home}/target.
For example, the following path:
<path id="streek.client.path">
<fileset dir="${streek.home}/target">
<include name="streek-ejbclient-${deploy.mode}.jar" />
<include name="*.jar" />
<include name="*.sar" />
</fileset>
</path>
would be replaced with:
<path id="streek.client.path">
<fileset dir="${maven.repo.home}">
<include name="streek-services/jars/*-${deploy.mode}-${default.streek.version}.jar" />
<include name="streek-services/jars/streek-appshutdown-lib-${default.streek.version}.jar" />
<include name="streek-services/sars/*-${deploy.mode}-${default.streek.version}.sar" />
<include name="streek-libs/jars/*-${default.streek.version}.jar" />
<include name="streek-libs/sars/*-${default.streek.version}.sar" />
</fileset>
</path>
Note that Streek classes specific to particular applications are distributed as application-specific JARs, of narrower scope than multi-application JARs produced in the depracated local streek builds. For example, the actual names of libraries whose general-case name is streek-${proj-specific-token}-admin-ejbclient-test-3.9.0.jar might exist in maven-repo as:
- streek-breez-ejbclientlib-test-3.9.0.jar
- streek-cweb-admin-ejbclient-test-3.9.0.jar
- streek-cweb-pub-ejbclient-test-3.9.0.jar
- streek-egrades-ejbclientlib-test-3.9.0.jar
- streek-iroster-ejbclientlib-test-3.9.0.jar
- streek-mailer-ejbclientlib-test-3.9.0.jar
- streek-roster-ejbclientlib-test-3.9.0.jar
- streek-rsf-signup-ejbclient-test-3.9.0.jar
- [...]
[In build files that cast a wide net vis-a-vis project.path, typically by including all JAR files in ${ist.jxde.home}/lib, will involve some detective work to determine which libraries, if any, are actually required for the build. For web application builds that do not compile Java classes, references to libraries in ${ist.jxde.home}/lib could be copy-paste cruft, and may not be necessary at all.]
Add target to obtain streek artifacts
The following target must be added to the project's top-level build file. It calls an imported macrodef to extract miscellaneous, uncompiled Streek artifacts into the project's build directory. The use of this target is described here
<!-- =================================================================== -->
<!-- extract-streek-misc task -->
<!-- =================================================================== -->
<target name="extract-streek-misc"
description="unpack versioned streek-artifacts-misc jar file into build.dir">
<antcall target="unpack-streek-artifacts-misc">
<param name="streek-artifacts-misc-version"
value="${default.streek.version}" />
</antcall>
</target>
Modify source of uncompiled Streek artifacts
Ant copy tasks that refer to uncompiled Streek resources such as configuration files, XSLTs, etc., must now reference the ${build.dir}/streek-artifacts-misc directory, rather than files in the Streek source tree.
It is essential that the extract-streek-misc target described above be executed before copy elements like the one below are executed. Typically, this is done by specifying depends="extract-streek-misc" on the target in which the copy node(s) occur(s).
For example, this copy node fragment:
<copy filtering="true" todir="${build.web-inf.dir}/classes/xsl" flatten="no">
<fileset dir="${streek.home}/src/xsl">
<include name="appshutdown-msg-html.xsl" />
</fileset>
[...]
</copy>
<copy filtering="true" todir="${build.web-inf.dir}/classes/xsl/templates" flatten="no">
<fileset dir="${streek.home}/src/xsl/xalan-java">
<include name="java-format-currency.xsl" />
<include name="java-format-date.xsl" />
<include name="render-options-html.xsl" />
</fileset>
</copy>
should be replaced with:
<copy filtering="true" todir="${build.web-inf.dir}/classes/xsl" flatten="no">
<fileset dir="${build.dir}/streek-artifacts-misc/xsl">
<include name="appshutdown-msg-html.xsl" />
</fileset>
[...]
</copy>
<copy filtering="true" todir="${build.web-inf.dir}/classes/xsl/templates" flatten="no">
<fileset dir="${build.dir}/streek-artifacts-misc/xsl/xalan-java">
<include name="java-format-currency.xsl" />
<include name="java-format-date.xsl" />
<include name="render-options-html.xsl" />
</fileset>
</copy>
Modify source of Streek JARs for inclusion in application WAR file
In the build-war target, nodes that copy Streek JARs must now reference the versioned artifacts in maven-repo rather than local build artifacts in ${streek.home}/target.
For example, the following copy task:
<copy file="${streek.home}/target/streek-web-tier.jar"
todir="${build.web-lib.dir}" />
should be replaced with:
<copy file="${maven.repo.home}/streek-libs/jars/streek-web-tier-${default.streek.version}.jar"
todir="${build.web-lib.dir}" />
Note that Streek classes specific to particular applications are distributed as application-specific JARs, of narrower scope than multi-application JARs produced in the depracated local streek builds. The EJB client library in the example given above illustrates the new JAR names.
Modify source of Streek and Third-Party JARs for inclusion in application EAR file
In the build-ear target, nodes that copy Streek and Third-Party JARs must now reference the versioned artifacts in maven-repo rather than local build artifacts in ${streek.home}/target or ${ist.jxde.home}/lib.
For example, the fileset nodes in the ear task (typically found in the build-ear target) that follows:
<ear destfile="${target.dir}/${ear.file}"
appxml="${build.meta-inf.dir}/application.xml" >
[...]
<fileset dir="${ist.jxde.home}/lib">
<include name="cos.jar" />
</fileset>
<fileset dir="${streek.home}/target">
<include name="streek-appshutdown-lib.jar" />
<include name="streek-ehf.jar" />
<include name="streek-dao.jar" />
<include name="streek-graphics.jar" />
<include name="streek-j2ee.jar" />
<include name="streek-security.jar" />
<include name="streek-util.jar" />
<include name="streek-breez-ejblib-${deploy.mode}.jar" />
<include name="streek-breez-ejb-${deploy.mode}.jar" />
</fileset>
[...]
</ear>
should be edited to look like this:
<ear destfile="${target.dir}/${ear.file}"
appxml="${build.meta-inf.dir}/application.xml" >
[...]
<fileset dir="${maven.repo.home}/cos/jars/">
<include name="cos-2002.11.05.jar" />
</fileset>
<fileset dir="${maven.repo.home}/streek-libs/jars/">
<include name="streek-ehf-${default.streek.version}.jar" />
<include name="streek-dao-${default.streek.version}.jar" />
<include name="streek-graphics-${default.streek.version}.jar" />
<include name="streek-j2ee-${default.streek.version}.jar" />
<include name="streek-security-${default.streek.version}.jar" />
<include name="streek-util-${default.streek.version}.jar" />
</fileset>
<fileset dir="${maven.repo.home}/streek-services/jars/">
<include name="streek-appshutdown-lib-${default.streek.version}.jar" />
<include name="streek-breez-ejblib-${default.streek.version}.jar" />
<include name="streek-breez-ejb-${deploy.mode}-${default.streek.version}.jar" />
</fileset>
[...]
</ear>
[Note that application-specific EJB library JARs streek-${appname}-ejblib-*.jar) are no longer deployment-mode specific.]
Modify source of Streek and Third-Party JSP Tag libraries
Tasks that copy tag libraries (typically in a target called taglibs) from ${streek.home}/target and/or ${ist.jxde.home}/taglibs must now reference the versioned artifacts in maven-repo instead.
For example, the following tasks in a taglibs target:
<copy
file="${ist.jxde.home}/taglibs/c.tld"
todir="${build.web-tld.dir}" />
<copy
file="${ist.jxde.home}/taglibs/jakarta-request.tld"
todir="${build.web-tld.dir}" />
<copy
file="${ist.jxde.home}/taglibs/jakarta-response.tld"
todir="${build.web-tld.dir}" />
<copy
file="${ist.jxde.home}/taglibs/jakarta-log.tld"
todir="${build.web-tld.dir}" />
<copy
file="${ist.jxde.home}/taglibs/sitemesh-page.tld"
todir="${build.web-tld.dir}" />
<copy
file="${ist.jxde.home}/taglibs/sitemesh-decorator.tld"
todir="${build.web-tld.dir}" />
<copy
file="${streek.home}/target/streek-transform.tld"
todir="${build.web-tld.dir}" />
<copy
file="${streek.home}/target/streek-workflow.tld"
todir="${build.web-tld.dir}" />
<copy
file="${streek.home}/target/streek-htmlform.tld"
todir="${build.web-tld.dir}" />
should be replaced by:
<copy filtering="true" todir="${build.web-tld.dir}" flatten="true">
<fileset dir="${maven.repo.home}/taglibs/tlds">
<include name="c-1.1.2.tld" />
<include name="request-1.0.1.tld" />
<include name="response-1.0.1.tld" />
<include name="log-1.0.tld" />
</fileset>
<fileset dir="${maven.repo.home}/sitemesh/tlds">
<include name="sitemesh-page-2.2.1.tld" />
<include name="sitemesh-decorator-2.2.1.tld" />
</fileset>
<fileset dir="${maven.repo.home}/streek-libs/tlds">
<include name="streek-transform-${default.streek.version}.tld" />
<include name="streek-workflow-${default.streek.version}.tld" />
<include name="streek-htmlform-${default.streek.version}.tld" />
</fileset>
</copy>
Modify source of Streek and Third-Party class libraries
Tasks that copy class libraries (typically in a target called third-party-jars) from ${streek.home}/target and/or ${ist.jxde.home}/lib must now reference the versioned artifacts in maven-repo instead.
For example, the following tasks in a third-party-jars target:
<copy
file="${ist.jxde.home}/jakarta-taglibs/jstl.jar"
todir="${build.web-lib.dir}" />
<copy
file="${ist.jxde.home}/jakarta-taglibs/standard.jar"
todir="${build.web-lib.dir}" />
<copy
file="${ist.jxde.home}/jakarta-taglibs/request.jar"
todir="${build.web-lib.dir}" />
<copy
file="${ist.jxde.home}/jakarta-taglibs/response.jar"
todir="${build.web-lib.dir}" />
<copy
file="${ist.jxde.home}/jakarta-taglibs/log.jar"
todir="${build.web-lib.dir}" />
<copy
file="${ist.jxde.home}/lib/sitemesh-2.0.1.jar"
todir="${build.web-lib.dir}" />
<copy
file="${ist.jxde.home}/lib/struts-1.1.jar"
todir="${build.web-lib.dir}" />
<copy
file="${streek.home}/target/streek-transform-tags.jar"
todir="${build.web-lib.dir}" />
<copy
file="${streek.home}/target/streek-workflow-tags.jar"
todir="${build.web-lib.dir}" />
<copy
file="${streek.home}/target/streek-htmlform-tags.jar"
todir="${build.web-lib.dir}" />
<copy file="${streek.home}/target/streek-web-tier.jar"
todir="${build.web-lib.dir}" />
should be replaced by:
<copy filtering="true" todir="${build.web-lib.dir}" flatten="true">
<fileset dir="${maven.repo.home}">
<include name="jstl/jars/jstl-1.1.1.jar" />
<include name="taglibs/jars/standard-1.1.1.jar" />
<include name="taglibs/jars/request-1.0.1.jar" />
<include name="taglibs/jars/response-1.0.1.jar" />
<include name="taglibs/jars/log-1.0.jar" />
<include name="sitemesh/jars/sitemesh-2.2.1.jar" />
<include name="struts/jars/struts-1.2.7.jar" />
<include name="streek-libs/jars/streek-transform-tags-${default.streek.version}.jar" />
<include name="streek-libs/jars/streek-workflow-tags-${default.streek.version}.jar" />
<include name="streek-libs/jars/streek-htmlform-tags-${default.streek.version}.jar" />
<include name="streek-libs/jars/streek-web-tier-${default.streek.version}.jar" />
</fileset>
</copy>
Modify package-appshutdown-sar task
The following call occurs in build files for applications that incorporate Streek's App Shutdown service, typically in the build-ear target:
<ant antfile="${ist.jxde.home}/antlib/build-client-appshutdown-sar.xml" />
The above should be modified to the following:
<ant antfile="${ist.jxde.home}/antlib/build-client-appshutdown-sar-streek-releases.xml" />
Add filters for configuration files
The copy task used to copy configuration files such as web.xml and application.xml from the source tree to the build tree's WEB-INF/ require addition of new filters in order to properly specify versioned streek artifacts in the configuration file (cf. discussion of the web.xml and application.xml config files in this document). For example, cf. the filterset below, from a target called web-deployment:
<!-- copy web.xml -->
<copy overwrite="true"
filtering="true"
file="${web.dd.dir}/web.xml"
tofile="${build.web-inf.dir}/web.xml">
<filterset>
<filter token="default.streek.version" value="${default.streek.version}" />
</filterset>
</copy>
An identical filterset needs to be added to the copy node that copies application.xml, typically found in the target build-ear.
Modifications to application.xml
Modifications to application.xml are necessary to refer to files that are now versioned. These modifications are related to the filterset additions described here. The example shows changes to selected modules that might typically be found in an app's application.xml deployment descriptor.
References like these:
<module>
<java>@streek-appshutdown-sar@</java>
</module>
<module>
<java>streek-appshutdown-lib.jar</java>
</module>
<module>
<java>streek-ehf.jar</java>
</module>
<module>
<java>streek-j2ee.jar</java>
</module>
<module>
<java>streek-security.jar</java>
</module>
<module>
<java>streek-util.jar</java>
</module>
<module>
<java>streek-dao.jar</java>
</module>
<module>
<java>streek-graphics.jar</java>
</module>
<module>
<java>streek-breez-ejblib-@deploy-mode@.jar</java>
</module>
<module>
<java>streek-breez-ejb-@deploy-mode@.jar</java>
</module>
should be edited to references like these (where @streek-appshutdown-sar@ resolves to something like breez-appshutdown-test.sar - breez being the webapp name):
<module>
<java>@streek-appshutdown-sar@</java>
</module>
<module>
<java>streek-appshutdown-lib-@default.streek.version@.jar</java>
</module>
<module>
<java>streek-ehf-@default.streek.version@.jar</java>
</module>
<module>
<java>streek-j2ee-@default.streek.version@.jar</java>
</module>
<module>
<java>streek-security-@default.streek.version@.jar</java>
</module>
<module>
<java>streek-util-@default.streek.version@.jar</java>
</module>
<module>
<java>streek-dao-@default.streek.version@.jar</java>
</module>
<module>
<java>streek-graphics-@default.streek.version@.jar</java>
</module>
<module>
<java>streek-breez-ejblib-@default.streek.version@.jar</java>
</module>
<module>
<java>streek-breez-ejb-@deploy-mode@-@default.streek.version@.jar</java>
</module>
[Note that application-specific EJB library JARs streek-${appname}-ejblib-*.jar) are no longer deployment-mode specific.]
Modifications to web.xml
Modifications to web.xml are necessary to refer to files that are now versioned. These modifications are related to the filterset additions described here. The example shows changes to referenced tag-library definitions files (*.tld). References like these:
<taglib>
<taglib-uri>jstl-cond</taglib-uri>
<taglib-location>/WEB-INF/tlds/c.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>sitemesh-page</taglib-uri>
<taglib-location>/WEB-INF/tlds/sitemesh-page.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>sitemesh-decorator</taglib-uri>
<taglib-location>/WEB-INF/tlds/sitemesh-decorator.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>jakarta-request</taglib-uri>
<taglib-location>/WEB-INF/tlds/jakarta-request.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>jakarta-response</taglib-uri>
<taglib-location>/WEB-INF/tlds/jakarta-response.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>jakarta-log</taglib-uri>
<taglib-location>/WEB-INF/tlds/jakarta-log.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>streek-transform</taglib-uri>
<taglib-location>/WEB-INF/tlds/streek-transform-@default.streek.version@.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>streek-workflow</taglib-uri>
<taglib-location>/WEB-INF/tlds/streek-workflow-@default.streek.version@.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>streek-htmlform</taglib-uri>
<taglib-location>/WEB-INF/tlds/streek-htmlform-@default.streek.version@.tld</taglib-location>
</taglib>
should be changed to match the versioned TLD files specified in build.xml (as described here), like this:
<taglib>
<taglib-uri>jstl-cond</taglib-uri>
<taglib-location>/WEB-INF/tlds/c-1.1.2.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>sitemesh-page</taglib-uri>
<taglib-location>/WEB-INF/tlds/sitemesh-page-2.2.1.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>sitemesh-decorator</taglib-uri>
<taglib-location>/WEB-INF/tlds/sitemesh-decorator-2.2.1.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>jakarta-request</taglib-uri>
<taglib-location>/WEB-INF/tlds/request-1.0.1.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>jakarta-response</taglib-uri>
<taglib-location>/WEB-INF/tlds/response-1.0.1.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>jakarta-log</taglib-uri>
<taglib-location>/WEB-INF/tlds/log-1.0.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>streek-transform</taglib-uri>
<taglib-location>/WEB-INF/tlds/streek-transform-@default.streek.version@.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>streek-workflow</taglib-uri>
<taglib-location>/WEB-INF/tlds/streek-workflow-@default.streek.version@.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>streek-htmlform</taglib-uri>
<taglib-location>/WEB-INF/tlds/streek-htmlform-@default.streek.version@.tld</taglib-location>
</taglib>
Modifying a JSP build file for Streek releases
A typical Streek web application has one or more build.xml files in its source tree. Analogous modifications to those given in examples above, for a root-level build.xml, are also applicable to these subsidiary build files.
One such subsidiary build file is, in many applications, /src/web/jsp/build.xml. The following modifications are among those that should be made to the JSP build file, as applicable.
JSP build.xml: modify path element references
Where the path element web.lib.path contains references to Streek JAR and SAR files previously copied from the local ${streek.home}/target, references should be changed to the maven-repo directory as described here for the top-level build.xml.
JSP build.xml: memory-monitor Ant file
In order to build the memory monitor from components in the maven-repo project instead of from the Streek source tree, change this reference (generally found in a target called build):
<ant antfile="${ist.jxde.home}/antlib/streek-memory-monitor.xml"/>
to this:
<ant antfile="${ist.jxde.home}/antlib/streek-memory-monitor-streek-releases.xml"/>
JSP build.xml: Jasper2 compilation macrodef import
The macrodef for compilation when JBoss4 is the deployment target exists in only one version (i.e., ${ist.jxde.home}/antlib/jasper2-jboss.macrodef), which obtains dependencies from maven-repo. If, on the other hand, JBoss 3.2x is the deployment target, the following import:
<import file="${ist.jxde.home}/antlib/jasper2-jboss.macrodef"/>
should be replaced with:
<import file="${ist.jxde.home}/antlib/jasper2-jboss-streek-releases.macrodef"/>
JSP build.xml: project path references
References in path elements to Streek classes or third-party libraries from ${ist.jxde.home}/lib must be changed to refer to libraries in maven-repo. Details are exactly analogous to those described for the application's top-level build.xml file; cf. here.


