<?xml version="1.0" encoding="GBK"?>
<project name="basms" basedir="." default="help">
<property file="build.properties"/>
<target name="all" depends="jsp2java,java2class,class2jar,clear"/>
<target name="help">
<echo message="显示功能列表"/>
<echo message="jsp2java 通过JspC将JSP转换成Java源代码"/>
<echo message="java2class 将转换后的Java源代码进行编译成class文件"/>
<echo message="class2jar 将编译后的class文件打包"/>
<echo message="clear 清理现场"/>
</target>
<target name="jsp2java" depends="help">
<taskdef classname="org.apache.jasper.JspC" name="jsp2java">
<classpath id="jsp2java.classpath">
<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>
<!-- 注意JSP文件要设置为UTF-8编码 -->
<jsp2java classpath="jsp2java.classpath" javaEncoding="UTF-8" validateXml="true" uriroot="${webapp.path}" webXmlFragment="${webapp.path}/WEB-INF/webJSP.xml" outputDir="${webapp.path}/WEB-INF/JspC/src"/>
</target>
<target name="java2class">
<mkdir dir="${webapp.path}/WEB-INF/JspC/classes"/>
<!-- 同样Java文件要设置为UTF-8编码 -->
<javac srcdir="${webapp.path}/WEB-INF/JspC/src" destdir="${webapp.path}/WEB-INF/JspC/classes" encoding="UTF-8" optimize="off" debug="on" failonerror="false" excludes="**/*.smap">
<classpath id="java2class.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="class2jar">
<mkdir dir="${webapp.path}/WEB-INF/lib"/>
<jar basedir="${webapp.path}/WEB-INF/JspC/classes" jarfile="${webapp.path}/WEB-INF/lib/${webapp.name}JSP.jar"/>
</target>
<target name="clear">
<delete dir="${webapp.path}/WEB-INF/JspC/classes"/>
<delete dir="${webapp.path}/WEB-INF/JspC/src"/>
<delete dir="${webapp.path}/WEB-INF/JspC"/>
</target>
</project>
在cmd下边执行结果如下:D:\chofo\web\basms>ant
Buildfile: build.xmlhelp:
[echo] 显示功能列表
[echo] jsp2java 通过JspC将JSP转换成Java源代码
[echo] java2class 将转换后的Java源代码进行编译成class文件
[echo] class2jar 将编译后的class文件打包
[echo] clear 清理现场BUILD SUCCESSFUL
Total time: 0 seconds
这个是没有结果的,好像是执行到一半就突然断了,请高手指点哪里有错啊。
<project name="basms" basedir="." default="help">
<property file="build.properties"/>
<target name="all" depends="jsp2java,java2class,class2jar,clear"/>
<target name="help">
<echo message="显示功能列表"/>
<echo message="jsp2java 通过JspC将JSP转换成Java源代码"/>
<echo message="java2class 将转换后的Java源代码进行编译成class文件"/>
<echo message="class2jar 将编译后的class文件打包"/>
<echo message="clear 清理现场"/>
</target>
<target name="jsp2java" depends="help">
<taskdef classname="org.apache.jasper.JspC" name="jsp2java">
<classpath id="jsp2java.classpath">
<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>
<!-- 注意JSP文件要设置为UTF-8编码 -->
<jsp2java classpath="jsp2java.classpath" javaEncoding="UTF-8" validateXml="true" uriroot="${webapp.path}" webXmlFragment="${webapp.path}/WEB-INF/webJSP.xml" outputDir="${webapp.path}/WEB-INF/JspC/src"/>
</target>
<target name="java2class">
<mkdir dir="${webapp.path}/WEB-INF/JspC/classes"/>
<!-- 同样Java文件要设置为UTF-8编码 -->
<javac srcdir="${webapp.path}/WEB-INF/JspC/src" destdir="${webapp.path}/WEB-INF/JspC/classes" encoding="UTF-8" optimize="off" debug="on" failonerror="false" excludes="**/*.smap">
<classpath id="java2class.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="class2jar">
<mkdir dir="${webapp.path}/WEB-INF/lib"/>
<jar basedir="${webapp.path}/WEB-INF/JspC/classes" jarfile="${webapp.path}/WEB-INF/lib/${webapp.name}JSP.jar"/>
</target>
<target name="clear">
<delete dir="${webapp.path}/WEB-INF/JspC/classes"/>
<delete dir="${webapp.path}/WEB-INF/JspC/src"/>
<delete dir="${webapp.path}/WEB-INF/JspC"/>
</target>
</project>
在cmd下边执行结果如下:D:\chofo\web\basms>ant
Buildfile: build.xmlhelp:
[echo] 显示功能列表
[echo] jsp2java 通过JspC将JSP转换成Java源代码
[echo] java2class 将转换后的Java源代码进行编译成class文件
[echo] class2jar 将编译后的class文件打包
[echo] clear 清理现场BUILD SUCCESSFUL
Total time: 0 seconds
这个是没有结果的,好像是执行到一半就突然断了,请高手指点哪里有错啊。
解决方案 »
- tomcat启动没有一点错误,却打不开欢迎界面
- 有关股票分析系统的问题 急等
- 关于售票系统的疑问?
- 使用socket发送消息,却提示HTTP/1.1 400 Bad Request
- java nio 长时间不发送数据断开客户端连接
- 拷贝别人写好的项目出现的问题
- 请问在spring中分散的service层用什么方法配置AOP的事务处理好?
- jsp的问题关于一个动态绑定的问题
- 不能直接调用request.getParameterMap().size()吗?
- ■■高薪诚聘J2EE程序员(5000-10000元)可兼职,限上海,北京,深圳!!!
- 高分求一功能简单给予Java Web的酒店管理系统源代码
- 邮件发送功能如何实现(j2ee)
<target name="help">
<echo message="显示功能列表"/>
<echo message="jsp2java 通过JspC将JSP转换成Java源代码"/>
<echo message="java2class 将转换后的Java源代码进行编译成class文件"/>
<echo message="class2jar 将编译后的class文件打包"/>
<echo message="clear 清理现场"/>
</target> 你要输入后面的命令,例如ant jsp2java,输入ant all可以做所有的事
你也可以将default="help"改为default="all"