jar -cvf my.war *.*ant创建一个target,
<target name="war" depends="compile"> <war warfile="${build}/my.war" webxml="${build}/WEB-INF/web.xml">
<lib dir="${build}/WEB-INF/lib"/>
<classes dir="${build}/WEB-INF/classes/"/>
<fileset dir="${build}"/> </war>
</target>把build.xml拷贝到你的WEB根目录下,在改目录下执行ant -buildfile build.xml war
<target name="war" depends="compile"> <war warfile="${build}/my.war" webxml="${build}/WEB-INF/web.xml">
<lib dir="${build}/WEB-INF/lib"/>
<classes dir="${build}/WEB-INF/classes/"/>
<fileset dir="${build}"/> </war>
</target>把build.xml拷贝到你的WEB根目录下,在改目录下执行ant -buildfile build.xml war
解决方案 »
- org.springframework.beans.factory.BeanCreationException:
- javaproject 怎么变成 webproject 在tomcat上运行
- struts2中如何让<s:iterator>里的多个<s:radio/>互不影响
- JAVA是怎样接收SOAP协议的包头的?
- jdk1.3怎么调用webservice xfire客户端可以用 在 jdk1.3上 吗
- 怎么对一个新闻的内容进行分页?
- validator在客户端验证时,遇到难题,大虾急救(@!@`````
- mybatis中动态sql里if标签困扰我很久的问题
- 关于javaBeans和EJB的区别的问题?
- jsp 中 session 或application 乱码问题
- struts问题-访问jsp页面出现:Cannot find ActionMappings or ActionFormBeans collection
- struts的小问题
<property environment="myenv" />
<property name="servletpath" value="${myenv.TOMCAT_HOME}/common/lib/servlet-api.jar" />
<property name="mysqlpath" value="c:/resin/doc/15com/WEB-INF/lib/mm.mysql-2.0.4-bin.jar" />
<property name="src" location="src"/>
<property name="build" location="build"/>
<target name="init">
<mkdir dir="${build}"/>
<mkdir dir="${build}\WEB-INF" />
<mkdir dir="${build}\WEB-INF\lib" />
<mkdir dir="${build}\WEB-INF\classes" />
</target>
<target name="compile" depends="init"
description="compile the source " >
<javac srcdir="${src}"
destdir="${build}/WEB-INF/classes"
classpath="${servletpath}:${mysqlpath}">
</javac>
</target>
<target name="war" depends="compile">
<war warfile="${build}/bookstore.war" webxml="${build}/WEB-INF/web.xml">
<lib dir="${build}/WEB-INF/lib"/>
<classes dir="${build}/WEB-INF/classes/"/>
<fileset dir="${build}"/>
</war>
</target>
<target name="dist" depends="compile"
description="generate the distribution" >
<jar jarfile="MyProject.jar" basedir="${build}"/>
</target>
<target name="clean"
description="clean up" >
<delete dir="${build}"/>
<delete dir="${dist}"/>
</target>
</project>上面是完整的,你搜索ANT文章,很多的。
Description
An extension of the Jar task with special treatment for files that should end up in the WEB-INF/lib, WEB-INF/classes or WEB-INF directories of the Web Application Archive.(The War task is a shortcut for specifying the particular layout of a WAR file. The same thing can be accomplished by using the prefix and fullpath attributes of zipfilesets in a Zip or Jar task.)The extended zipfileset element from the zip task (with attributes prefix, fullpath, and src) is available in the War task.
<target name="war" depends="compile">
<war warfile="${warDir}\mlmproject.war" webxml="${webDir}\WEB-INF\web.xml">
<lib dir="${webDir}\WEB-INF\lib"/>
<classes dir="${buildDir}"/>
<fileset dir="${webDir}"/>
</war>
</target>
我确认路径都对1.制作war包时,提示如下错误:
[war] Warning: selected war files include a WEB-INF/web.xml which will be ignored (please use webxml attribute to war task)
这个错误是什么意思?
2.在我的web-inf\classes里面有个ChangeReqEncoding.class类,使解决中文问题的filter,这个类在war包中除下了两次,同时在web-inf\lib目录下,class12.jar,smartupload.jar也都是双份
3.我的项目下有个upload目录,里面是中文的文件夹,做成war后看到的是中文乱码,在我的build.xml文件中第一行已经是:<?xml version="1.0" encoding="gb2312"?>请问如上是什么问题?谢谢