I have an ANT build that I need to setup so on deployment of the .war a certain file will be placed in a specific location. Currently my ant builds the war as follows...
<target name="war" depends="jar">
<war destfile="${deploy}/file.war" webxml="${web-inf}/web.xml">
<fileset dir="${WebRoot}">
<include name="**/*.vm" />
<include name="**/*.js" />
<include name="**/*.jsp" />
<include name="**/*.html" />
<include name="**/*.css" />
<include name="**/*.gif" />
<include name="**/*.jpg" />
<include name="**/*.png" />
<include name="**/*.tld" />
<include name="**/applicationC开发者_开发百科ontext*.xml" />
<include name="**/jpivot/**" />
<include name="**/wcf/**" />
<include name="**/platform/**" />
<include name="**/Reports/**" />
</fileset>
<lib dir="${web-inf.lib}" />
</war>
</target>
The file I need is called Scriptlet.class and it needs to be in WebRoot/WEB-INF/classes/
I've tried several things to get this to work and have yet to find one that works... if anyone can point me in the right direction I'd appreciate it!
Use the classes
element to put a file in WEB-INF/classes
:
<target name="war" depends="jar">
<war destfile="${deploy}/file.war" webxml="${web-inf}/web.xml">
<classes dir="${web-inf.classes}">
<include name="**/Scriptlet.class"/>
</classes>
<fileset dir="${WebRoot}">
<include name="**/*.vm" />
<include name="**/*.js" />
<include name="**/*.jsp" />
<include name="**/*.html" />
<include name="**/*.css" />
<include name="**/*.gif" />
<include name="**/*.jpg" />
<include name="**/*.png" />
<include name="**/*.tld" />
<include name="**/applicationContext*.xml" />
<include name="**/jpivot/**" />
<include name="**/wcf/**" />
<include name="**/platform/**" />
<include name="**/Reports/**" />
</fileset>
<lib dir="${web-inf.lib}" />
</war>
</target>
You can use the nested <classes>
element to specify a FileSet to appear in WEB-INF/classes
. Take a look at the manual page on the <war>
task.
精彩评论