[英]How to include Classpath jars in WEB-INF/lib Folder while creating a WarFile using Ant Build Script
我正在創建用於構建和部署項目的ant腳本。 項目結構如下:
Projectname
--src
--tst
--lib ( I have 5 jars here)
--resources
--WebContent
--META-INF
--WEB-INF
--lib (I have 3 jars here)
--properties
--templates
--stylesheets
--web.xml
當我使用ant腳本創建war文件時,war文件的結構應如下所示:
--WEB-INF
--classes
--lib (should contain all the jar files from the entire project. ie, jars from the lib folders of the project and also the classpath)
--META-INF
--MANIFEST.MF
但是,當我構建項目時,創建的war文件具有以下結構,這是不正確的,我希望該結構與上述結構相似。
--WEB-INF
--classes
--lib( is containing the jars that are in the lib folders of the project but it should also contain the classpath jars)
--META-INF
--MANIFEST.MF
--abc.jar { These are the classpath jars that should also be in the WEB-INF/lib folder but they are not)
--xyz.jar
--mnf.jar
--qrs.jar
Here is the code snippet am using to create the WAR file in the build.xml file.
<target name="war" description="Bundles the application as a WAR file" depends="build">
<echo> === PACKAGE WAR ====== </echo>
<delete dir="target" failonerror="false"/>
<mkdir dir="target"/>
<war destfile="target/test.war" needxmlfile="false" >
<fileset dir="WebContent">
<include name="**/*.*"/>
</fileset>
<path>
<path refid="MobileServices.classpath"/>
<fileset dir="${lib.dir}" includes="**/*.jar">
</fileset>
</path>
<classes dir="WebContent/WEB-INF/classes"/>
</war>
我正在使用<path refid="> to include the classpath jars in the warfile.
非常感謝任何幫助。
代替使用<fileset dir =“ $ {lib.dir}” includes =“ ** / *。jar”>
</文件集>
嘗試
<lib dir =“ $ {lib.dir}” includes =“ ** / *。jar”>
</ LIB>
並將其移到path標簽之外。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.