Ant文件:
<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." default="makeWar" name="TestURL">
<target name="makeWar">
<delete file="C:/bea/user_projects/domains/myDomain/autodeploy/TestURL.war">
</delete>
<war destfile="C:/bea/user_projects/domains/myDomain/autodeploy/TestURL.war"
webxml="WebContent/WEB-INF/web.xml">
<fileset dir="WebContent" excludes="**/web.xml">
</fileset>
<classes dir="build/classes"></classes>
</war>
</target>
</project>
使用excludes="**/web.xml"避免警告:Warning: selected war files include a WEB-INF/web.xml which will be
ignored (please use webxml attribute to war task),该警告原因是<war>tag中的webxml属性已经指定web.xml文件,fileset中再次指定该文件,在war包中copy了2次。
使用classes指定TestURL.war/WEB-INF/classes中要包含的class文件。
<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." default="makeWar" name="TestURL">
<target name="makeWar">
<delete file="C:/bea/user_projects/domains/myDomain/autodeploy/TestURL.war">
</delete>
<war destfile="C:/bea/user_projects/domains/myDomain/autodeploy/TestURL.war"
webxml="WebContent/WEB-INF/web.xml">
<fileset dir="WebContent" excludes="**/web.xml">
</fileset>
<classes dir="build/classes"></classes>
</war>
</target>
</project>
使用excludes="**/web.xml"避免警告:Warning: selected war files include a WEB-INF/web.xml which will be
ignored (please use webxml attribute to war task),该警告原因是<war>tag中的webxml属性已经指定web.xml文件,fileset中再次指定该文件,在war包中copy了2次。
使用classes指定TestURL.war/WEB-INF/classes中要包含的class文件。
本文介绍了一个使用Ant构建工具来创建WAR文件的示例配置。通过排除重复的web.xml文件并指定classes目录,确保WAR文件正确构建,避免警告信息。
1906

被折叠的 条评论
为什么被折叠?



