jsp自动编译

上一篇 / 下一篇  2007-10-24 17:52:22 / 个人分类:ant

利用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>


相关阅读:

TAG: ant Ant

 

评分:0

我来说两句

我的栏目

日历

« 2024-05-07  
   1234
567891011
12131415161718
19202122232425
262728293031 

数据统计

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

RSS订阅

Open Toolbar