在Tdk_Home目录下的build.properties我只是加了
tdk.home = .在webapps\newapp\WEB-INF\build中的build.xml我没有改过。

解决方案 »

  1.   

    生成的build.xml文件是这样的。<?xml version="1.0"?><project name="peer" default="compile" basedir=".">  <property file="${user.home}/build.properties"/>
      <property file="build.properties"/>
      <property file="project.properties"/>  <!-- This value is currently set as a property because
           the top level tdk build.xml file runs the "init" target
           as part of testing and texen doesn't obey the ${basedir}
           property so we must pass in the full path to the
           build.properties for use with the contextProperties attribute.
      -->
      <property name="build.properties" value="build.properties"/>  <path id="classpath">
        <fileset dir="${tdk.home}/webapps/${tdk.project}/WEB-INF/lib">
          <include name="**/*.jar"/>
        </fileset>
      </path>  <!-- ================================================================ -->
      <!-- D E P L O Y M E N T  T A R G E T S                               -->
      <!-- ================================================================ -->  <target
        name="assemble-webapp-in-container"
        depends="init">    <copy todir="${build.webappRoot}">
          <fileset dir=".">
            <include name="images/**"/>
            <include name="resources/**"/>
            <include name="templates/**"/>
          </fileset>
        </copy>    <copy todir="${build.webappRoot}/WEB-INF">
          <fileset dir=".">
            <include name="setup/**"/>
          </fileset>
        </copy>    <!-- Move the application configuration files into position. -->
        <copy todir="${build.webappRoot}/WEB-INF/conf">
          <fileset dir="src/conf"/>
        </copy>    <!-- Adjust the deployment descriptor from cvslayout mode
             back to in-container mode. -->    <ant dir="${tdk.home}" target="deployment-descriptor">
          <property name="app.root" value="webappContext"/>
          <property name="app.properties" value="/WEB-INF/conf/TurbineResources.properties"/>
        </ant>  </target>  <target
        name="deploy-war"
        depends="assemble-webapp-in-container">    <jar jarfile="${tdk.project}.war">
          <fileset dir="${tdk.home}/webapps">
            <include name="${tdk.project}/**"/>
          </fileset>
        </jar>
      </target>  <target
        name="deploy-container"
        depends="assemble-webapp-in-container">    <mkdir dir="target/${tdk.project}"/>
        <copy todir="target/${tdk.project}">
          <fileset dir="${tdk.home}">
            <exclude name="tdk/**"/>
            <exclude name="build.xml"/>
            <exclude name="build.properties"/>
            <exclude name="GETTING_STARTED.txt"/>
          </fileset>
        </copy>    <tar longfile="gnu" tarfile="${tdk.project}.tar">
          <tarfileset dir="target" mode="755">
            <include name="**/*.sh"/>
          </tarfileset>
          <tarfileset dir="target">
            <include name="**"/>
            <exclude name="**/*.sh"/>
          </tarfileset>
        </tar>    <gzip zipfile="${tdk.project}.tar.gz" src="${tdk.project}.tar"/>
        <zip zipfile="${tdk.project}.zip" basedir="target"/>
        <delete file="${tdk.project}.tar"/>
      </target>
      

  2.   

    <!-- ================================================================ -->
      <!-- S E T U P  T A R G E T                                           -->
      <!-- ================================================================ -->
      <!-- Check that properties are defined correctly.                     -->
      <!-- ================================================================ -->  <target
        name="setup"
        unless="tdk.home">    <echo>
          ***
          * ERROR : The 'tdk.home' property is not defined or
          * is pointing to an invalid directory.
          *
          * In your personal build.properties define tdk.home to
          * point to an absolute path where your tdk is installed.
          * Example: tdk.home=${user.home}/tdk
          ***
        </echo>
        <fail message="ERROR: tdk.home not defined properly: ${tdk.home}"/>
      </target>  <!-- ================================================================ -->
      <!-- I N I T  T A S K  T A R G E T                                    -->
      <!-- ================================================================ -->
      <!-- Taskdefs are defined inside this target as Ant seems to have     -->
      <!-- problems defining them at the top level.                         -->
      <!-- ================================================================ -->  <target name="init-tasks" depends="setup">    <taskdef name="texen"
          classname="org.apache.velocity.texen.ant.TexenTask">
          <classpath refid="classpath"/>
        </taskdef><!--
        <taskdef name="format-source"
          classname="jstyle.FormatTask">
          <classpath refid="classpath"/>
        </taskdef>
    -->
      </target>  <!-- ================================================================ -->
      <!-- I N I T  T A R G E T                                             -->
      <!-- ================================================================ -->
      <!-- You will probably only run this target once. It will generate    -->
      <!-- your sources for you and compile them.                           -->
      <!-- ================================================================ -->  <target
        name="init"
        depends="setup-webinf"
        description="--> generates the full application">    <antcall target="create-database"/>
        <antcall target="schema-sql"/>
        <antcall target="idtable-init-sql"/>
        <antcall target="security-sql"/>
        <antcall target="insert-sql-files"/>
        <antcall target="update-tr-props"/>
        <antcall target="project-om"/>
        <antcall target="compile"/>
      </target>  <!-- ================================================================ -->
      <!-- C R E A T E  T A R G E T  D A T A B A S E                        -->
      <!-- ================================================================ -->
      <!-- Create the target database by executing a generated script       -->
      <!-- that is capable of performing the task.                          -->
      <!-- ================================================================ -->  <target
        name="create-database"
        depends="init-tasks"
        unless="database.manual.creation"
        description="--> generates the target database">    <ant
          antfile="${torque.buildFile}"
          target="create-db">
        </ant>
      </target>
      

  3.   

    <!-- ================================================================ -->
      <!--                                                                  -->
      <!-- G E N E R A T E  T A B L E  S Q L                                -->
      <!--                                                                  -->
      <!-- ================================================================ -->  <target
        name="schema-sql"
        depends="init-tasks"
        description="--> generates the sql-script for your project">    <ant
          antfile="${torque.buildFile}"
          target="sql">
        </ant>
      </target>  <!-- ================================================================ -->
      <!--                                                                  -->
      <!-- G E N E R A T E  I D  B R O K E R  I N I T  S Q L                -->
      <!--                                                                  -->
      <!-- ================================================================ -->  <target
        name="idtable-init-sql">    <ant
          antfile="${torque.buildFile}"
          target="id-table-init-sql">
        </ant>
      </target>  <target
        name="security-sql"
        unless="noSecuritySQL"
        description="Creates SQL to initialize the security system.">    <taskdef
          name="torque-datasql"
          classname="org.apache.torque.task.TorqueDataSQLTask">
          <classpath refid="classpath"/>
        </taskdef>    <torque-datasql
          contextProperties="${build.properties}"
          controlTemplate="${DataSQLControlTemplate}"
          outputDirectory="${src.dir}/sql"
          useClasspath="true"
          outputFile="turbine-security.sql"
          xmlFile="${conf.dir}/turbine-schema.xml"
          dataXmlFile="${conf.dir}/turbine-security.xml"
          dataDTD="${conf.dir}/turbine-security.dtd"
          targetDatabase="${database}"
          sqldbmap="${src.dir}/sql/sqldb.map"
        />
    <!--
        <ant
          antfile="${torque.buildFile}"
          target="project-datasql">
        </ant>
    -->
      </target>  <!-- ================================================================ -->
      <!-- G E N E R A T E  P R O J E C T  P E E R  B A S E D  O M          -->
      <!-- ================================================================ -->
      <!-- Generate the Peer-based object model for your project.           -->
      <!-- These are in addition to the base Turbine OM!                    -->
      <!-- ================================================================ -->  <target
        name="project-om"
        unless="noObjectModel"
        description="--> generates the peer-based object model for your project">    <ant
          antfile="${torque.buildFile}"
          target="om">
        </ant>    <!--
        <format-source>
          <fileset dir="${src.dir}/${targetDirectory}">
            <include name="**/*.java"/>
          </fileset>
        </format-source>
        -->  </target>  <!-- ================================================================ -->
      <!-- I N S E R T  S I N G L E  S Q L  F I L E                         -->
      <!-- ================================================================ -->  <target
        name="setDatabaseUrl"
        if="build.databaseUrl">    <property name="sqlInsert.databaseUrl" value="${build.databaseUrl}"/>
      </target>  <target
        name="insert-sql-files"
        depends="setDatabaseUrl">    <property name="sqlInsert.databaseUrl" value="${databaseUrl}"/>    <ant
          antfile="${torque.buildFile}"
          target="insert-sql">
        </ant><!--
        <sql-tdk
          driver="${databaseDriver}"
          url="${sqlInsert.databaseUrl}"
          userid="${databaseUser}"
          password="${databasePassword}"
          autocommit="true"
          onerror="continue"
          sqldbmap="${src.dir}/sql/sqldb.map"
          srcDir="${src.dir}/sql">
          <classpath refid="classpath"/>
        </sql-tdk>
    -->
      </target>  <!-- ================================================================ -->
      <!-- U P D A T E  T U R B I N E  R E S O U R C E S  P R O P S         -->
      <!-- ================================================================ -->  <target
        name="update-tr-props">    <filter token="APPLICATION_ROOT" value="."/>
        <filter token="DATABASE" value="${database}"/>
        <filter token="DATABASE_DRIVER" value="${databaseDriver}"/>
        <filter token="DATABASE_URL" value="${databaseUrl}"/>
        <filter token="DATABASE_BUILD_URL" value="${build.databaseUrl}"/>
        <filter token="DATABASE_USER" value="${databaseUser}"/>
        <filter token="DATABASE_PASSWORD" value="${databasePassword}"/>
        <filter token="DATABASE_HOST" value="${databaseHost}"/>
        <filter token="DATABASE_DEFAULT" value="${tdk.project}"/>    <property name="database.descriptor" value="${master.conf.dir}/database/${database}"/>
        <property name="database.name" value="${tdk.project}"/>
        <property file="${database.descriptor}"/>    <filter token="DATABASE_ADAPTOR" value="${database.adaptor}"/>    <copy
          file="${conf.dir}/TurbineResources.template"
          tofile="${conf.dir}/TurbineResources.properties"
          overwrite="yes"
          filtering="yes"
        />
        <copy
          file="${conf.dir}/Torque.template"
          tofile="${conf.dir}/Torque.properties"
          overwrite="yes"
          filtering="yes"
        />
      </target>