发布新日志

  • jsp自动编译

    2007-10-24 17:52:22

    利用ant+jasper来完成

    <project name="Webapp Precompilation" default="all" basedir=".">

      <target name="jspc"  >
        <taskdef classname="org.apache.jasper.JspC" name="jasper2" >
          <classpath id="jspc.classpath">
            <pathelement location="${java.home}/../lib/tools.jar"/>
            <fileset dir="${tomcat.home}/bin">
              <include name="*.jar"/>
            </fileset>
            <fileset dir="${tomcat.home}/server/lib">
              <include name="*.jar"/>
            </fileset>
            <fileset dir="${tomcat.home}/common/lib">
              <include name="*.jar"/>
            </fileset>
          </classpath>
        </taskdef>
        <jasper2
                 validateXml="false"
                 uriroot="${webapp.path}"
                 webXmlFragment="${webapp.path}/WEB-INF/gweb.xml"
                 ōutputDir="${webapp.path}/WEB-INF/src" />
      </target>
     
     

      <target name="compile">

        <mkdir dir="${webapp.path}/WEB-INF/classes"/>
        <mkdir dir="${webapp.path}/WEB-INF/lib"/>

        <javac destdir="${webapp.path}/WEB-INF/classes"
               ōptimize="off"
               debug="on" failonerror="false"
               srcdir="${webapp.path}/WEB-INF/src"
        excludes="**/*.smap"
        encoding="UTF-8" fork="true" memoryMaximumSize="512m">
          <classpath>
            <pathelement location="${webapp.path}/WEB-INF/classes"/>
            <fileset dir="${webapp.path}/WEB-INF/lib">
              <include name="*.jar"/>
            </fileset>
            <pathelement location="${tomcat.home}/common/classes"/>
            <fileset dir="${tomcat.home}/common/lib">
              <include name="*.jar"/>
            </fileset>
            <pathelement location="${tomcat.home}/shared/classes"/>
            <fileset dir="${tomcat.home}/shared/lib">
              <include name="*.jar"/>
            </fileset>
            <fileset dir="${tomcat.home}/bin">
              <include name="*.jar"/>
            </fileset>
          </classpath>
          <include name="**" />
          <exclude name="tags/**" />
        </javac>

      </target>

      <target name="all" depends="jspc,compile">
      </target>

     </project>

我的栏目

数据统计

  • 访问量: 5213
  • 日志数: 6
  • 建立时间: 2007-06-23
  • 更新时间: 2008-02-18

RSS订阅

Open Toolbar