ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Frank W. Zammetti" <>
Subject Re: AW: AW: Way to refresh properties?
Date Tue, 14 Feb 2006 18:05:41 GMT
The whole script is a little over 1,000 lines, so posting the whole thing
wouldn't be too nice :)  But, here is a trimmed-down version that should
give you the info you want...  It should be noted that my Ant scripts are
note what one would call "typical"... I do things a little differently,
but I prefer it done this way... anyway...

<project name="MyProject" default="build" basedir="." >

  <property file="" />
  <property file="" />

  <path id="classpath">
    <pathelement location="../WEB-INF/lib/commons-beanutils.jar" />
    <pathelement location="../WEB-INF/lib/struts.jar" />
    <pathelement location="../source/temp" />

  <target name="build">
    <get_dependencies />
    <taskdef resource="net/sf/antcontrib/">
      <classpath refid="compiletime_classpath" />
    <set_props />
    <antcall target="compile_app" inheritRefs="true" />
    <antcall target="junit_tests" inheritRefs="true" />
    <antcall target="static_analysis_checkstyle" inheritRefs="true" />

  <macrodef name="get_dependencies">
      <echo message=" " />
      <echo message="Retrieving dependencies..." />
      <setproxy proxyhost="${proxy_host}" proxyport="${proxy_port}" />
      <typedef classpath="libutils/ant-dependencies.jar"
       resource="" />
        <dependencies pathId="compiletime_classpath" verbose="true">
	        <dependency group="servletapi" version="2.3" />
	        <dependency group="checkstyle" version="4.0-beta5" />
	        <dependency group="checkstyle" artifact="checkstyle-optional"
	         version="4.0-beta5" />
	        <dependency group="antlr" version="2.7.5" />
	        <dependency group="regexp" version="1.3" />
	        <dependency group="junit" version="3.8.1" />
	        <dependency group="ant-contrib" version="20020829" />
      <echo message="Done" />

  <macrodef name="set_props">
    <echo message="Setting build control properties..." />
    <taskdef name="antform" classname="com.sardak.antform.AntForm"
		  classpath="libutils/antform.jar" />
		<antform title="" save=""
		  image="../img/appTitle.gif" resetMessage="" okMessage="Build">
    <label>Check off the tasks you wish to execute for this build, or
close the window to abort the build.  Note that ONE AND ONLY ONE of
the options in the first section should MUST be selected.  Also note
that the application in exploded format is always set up for Tomcat
only, and the EAR is always set up for Websphere only, and both are
set up in whatever mode is indicated by the first four items. 
Security IS NOT enabled in Tomcat.</label>
			<separator />
			<booleanProperty label="Target build for DEVELOPMENT environment
			  property="appmode_dev" />
			  label="Target build for STEST environment (appmode_stest)"
			  property="appmode_stest" />
			  label="Target build for ATEST environment (appmode_atest)"
			  property="appmode_atest" />
			  label="Target build for PRODUCTION environment (appmode_prod)"
			  property="appmode_prod" />
			<separator />
			  label="Run CheckStyle on all code (do_static_analysis_checkstyle)"
			  property="do_static_analysis_checkstyle" />
			<booleanProperty label="Perform unit tests (do_unit_tests)"
			  property="do_unit_tests" />
		<echo message="Done" />

  <!-- Compile the app. -->
  <target name="compile_app">
    <echo message="Compiling app..." />
    <delete dir="../WEB-INF/classes/com" />
    <mkdir dir="../WEB-INF/classes/com" />
    <javac srcdir="${basedir}"
     debug="true" debuglevel="lines,vars,source"
     destdir="../WEB-INF/classes" deprecation="on"
      <classpath refid="classpath" />
      <classpath refid="compiletime_classpath" />
    <echo message="Done" />

  <!-- Perform any JUnit tests required. -->
  <target name="junit_tests">
      <equals arg1="${do_unit_tests}" arg2="true" />
        <echo message="Performing JUnit Tests..." />
        <javac srcdir="junittests"
         destdir="temp" deprecation="on">
          <classpath refid="classpath" />
          <classpath refid="compiletime_classpath" />
        <junit printsummary="on" haltonerror="yes" haltonfailure="yes">
          <classpath refid="classpath" />
          <classpath refid="compiletime_classpath" />
          <formatter type="brief" usefile="false" />
          <test name="junittests.DisbursementDelegateTestCase" />
        <echo message="Done" />
        <echo message="Skipping junit_tests" />

  <!-- Performs static code analysis using CheckStyle. -->
  <target name="static_analysis_checkstyle">
      <equals arg1="${do_static_analysis_checkstyle}" arg2="true" />
        <echo message="Performing static code analysis using
CheckStyle..." />
        <delete file="static_analysis_checkstyle.xml" />
        <taskdef resource="">
          <classpath refid="classpath" />
          <classpath refid="compiletime_classpath" />
        <checkstyle config="libutils/checkstyle_checks.xml"
          <classpath refid="classpath" />
          <classpath refid="compiletime_classpath" />
          <fileset dir="com" includes="**/*.java" />
          <formatter type="xml"
           toFile="static_analysis_checkstyle.xml" />
        <echo message="Done" />
        <echo message="Skipping static_analysis_checkstyle" />


And, for completeness, is nothing but:


Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
AIM: fzammetti
Yahoo: fzammetti

On Tue, February 14, 2006 12:33 pm, Ivan \"Rambius\" Ivanov said:
> Hello Frank,
> --- "Frank W. Zammetti" <> wrote:
>> I don't know if it's the right way to do it, or if
>> there is some reason
>> not to do it this way, but I found a solution... I
>> took the contents of
>> the target that executed Antform and put it in a
>> macrodef... doing that,
>> the properties DO get changed as expected.
> Can you post your code? I got interesed because
> properties are immutable, no matter where you send
> them - in a ordinary target or in a macrodef.
> Regards
> Ivan
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message