如何在 Ant 脚本中设置具有不同目录的 war 文件
对此还很陌生,所以请耐心等待。我已经让 Ant build.xml 运行并填充了我想要的所有内容,但我的内容(js、css、jsp 等)只是塞进了 WAR 的最顶层目录中。我希望将此内容放入我需要在战争中制作的 WEB-INF 文件夹中。这是我目前掌握的情况,仅供参考。如果我能看到一个如何做到这一点的例子,我想我会很好。试图遵循这个线程,是我缺少的dist设置吗?
<war warfile="${build}/${project.name}.war" webxml="${appconf}/web.xml">
<classes dir="${appconf}/classes" />
<fileset dir="${appcontent}" includes="jsp/**,js/**,images/**,css/**,tg/**" excludes="**/*.~js,**/*.~jav,**/*.java,cvs,annotation">
<patternset id="jsp_images_package">
<include name="**/*.jsp,**/*.js,**/*.gif,**/*.html,**/*.css"/>
<exclude name="**/*.~js,**/*.~jav"/>
</patternset>
</fileset>
<fileset dir="${appcontent}" includes="WEB-INF/lib/*.jar,WEB-INF/*.jar"/>
<fileset dir="${appcontent}" includes="WEB-INF/lib/*.css"/>
<fileset dir="${appcontent}" includes="docs/*.doc"/>
</war>
Pretty new to this so bear with me. I've gotten my Ant build.xml to run and populate everything that I want, but my content (js, css, jsp, etc) is just jammed into the WAR at its topmost directory. I'm looking to put this content into the WEB-INF folder that I would need to make within the war. Here's what I have so far as a reference. If I could just see an example of how to do this I think I would be good. Tried to follow this thread, is that dist setup what I am missing??
<war warfile="${build}/${project.name}.war" webxml="${appconf}/web.xml">
<classes dir="${appconf}/classes" />
<fileset dir="${appcontent}" includes="jsp/**,js/**,images/**,css/**,tg/**" excludes="**/*.~js,**/*.~jav,**/*.java,cvs,annotation">
<patternset id="jsp_images_package">
<include name="**/*.jsp,**/*.js,**/*.gif,**/*.html,**/*.css"/>
<exclude name="**/*.~js,**/*.~jav"/>
</patternset>
</fileset>
<fileset dir="${appcontent}" includes="WEB-INF/lib/*.jar,WEB-INF/*.jar"/>
<fileset dir="${appcontent}" includes="WEB-INF/lib/*.css"/>
<fileset dir="${appcontent}" includes="docs/*.doc"/>
</war>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在本例中您要使用的是
。它应该看起来像这样(你的结构很奇怪,所以我无法准确说出你想要文件的位置)。What you want to use in this case is
<zipfileset>
. It should look something like this (Your structure is weird, so I can't tell exactly where you want files).