<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Ant build script for WAR file Archives - scmGalaxy</title>
	<atom:link href="https://www.scmgalaxy.com/tutorials/tag/ant-build-script-for-war-file/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.scmgalaxy.com/tutorials/tag/ant-build-script-for-war-file/</link>
	<description>A Platform for Software Engineers</description>
	<lastBuildDate>Sat, 27 Feb 2021 09:53:54 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1</generator>
	<item>
		<title>A sample Ant build script that builds a WAR file &#8211;  Guide</title>
		<link>https://www.scmgalaxy.com/tutorials/a-sample-ant-build-script-that-builds-a-war-file/</link>
					<comments>https://www.scmgalaxy.com/tutorials/a-sample-ant-build-script-that-builds-a-war-file/#respond</comments>
		
		<dc:creator><![CDATA[scmgalaxy K]]></dc:creator>
		<pubDate>Thu, 22 Jul 2010 11:05:35 +0000</pubDate>
				<category><![CDATA[Build Management & Tools]]></category>
		<category><![CDATA[ANT]]></category>
		<category><![CDATA[Ant Build]]></category>
		<category><![CDATA[Ant build script]]></category>
		<category><![CDATA[Ant build script for WAR file]]></category>
		<category><![CDATA[Ant script to build War file]]></category>
		<category><![CDATA[Ant WAR task]]></category>
		<category><![CDATA[ant war task meta inf example]]></category>
		<category><![CDATA[Build WAR file]]></category>
		<category><![CDATA[Build War file using Ant]]></category>
		<category><![CDATA[Build War File with Ant]]></category>
		<category><![CDATA[commands]]></category>
		<category><![CDATA[create war file using ant command]]></category>
		<category><![CDATA[Guide]]></category>
		<category><![CDATA[How To]]></category>
		<category><![CDATA[Process]]></category>
		<category><![CDATA[Sample]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[WAR file]]></category>
		<guid isPermaLink="false">http://www.scmgalaxy.com/tutorials/2010/07/22/a-sample-ant-build-script-that-builds-a-war-file/</guid>

					<description><![CDATA[<p>A sample Ant build script that builds a WAR file &#60;project name=&#8221;MyWebApplication&#8221; basedir=&#8221;..&#8221; default=&#8221;install&#8221;&#62; &#60;!&#8211; project-specific variables &#8211;&#62; &#60;property name=&#8221;jsp.dir.name&#8221; [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/a-sample-ant-build-script-that-builds-a-war-file/">A sample Ant build script that builds a WAR file &#8211;  Guide</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><img fetchpriority="high" decoding="async" class="alignnone size-full wp-image-4408" src="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2010/07/ant-build-script.png" alt="ant-build-script-war-file" width="600" height="400" srcset="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2010/07/ant-build-script.png 600w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2010/07/ant-build-script-300x200.png 300w" sizes="(max-width: 600px) 100vw, 600px" /></p>
<p><strong>A sample Ant build script that builds a WAR file</strong></p>
<p>&lt;project name=&#8221;MyWebApplication&#8221; basedir=&#8221;..&#8221; default=&#8221;install&#8221;&gt;</p>
<p>&lt;!&#8211; project-specific variables &#8211;&gt;<br />
&lt;property name=&#8221;jsp.dir.name&#8221; value=&#8221;myapp&#8221; /&gt;<br />
&lt;property name=&#8221;package.name&#8221; value=&#8221;${jsp.dir.name}.war&#8221; /&gt;<br />
&lt;property name=&#8221;webapp.dir&#8221; value=&#8221;/Users/al/tomcat-6.0.16/webapps&#8221; /&gt;</p>
<p>&lt;property environment=&#8221;env&#8221; /&gt;<br />
&lt;property name=&#8221;build.dir&#8221; value=&#8221;build&#8221; /&gt;<br />
&lt;property file=&#8221;${build.dir}/build.${env.HOSTNAME}&#8221; /&gt;</p>
<p>&lt;property name=&#8221;lib.dir&#8221; value=&#8221;lib&#8221; /&gt;<br />
&lt;property name=&#8221;pages.dir&#8221; value=&#8221;pages&#8221; /&gt;<br />
&lt;property name=&#8221;src.dir&#8221; value=&#8221;src&#8221; /&gt;<br />
&lt;property name=&#8221;src.tests.dir&#8221; value=&#8221;src-tests&#8221; /&gt;<br />
&lt;property name=&#8221;resources.dir&#8221; value=&#8221;resources&#8221; /&gt;<br />
&lt;property name=&#8221;dest.dir&#8221; value=&#8221;target&#8221; /&gt;</p>
<p>&lt;!&#8211; put everything in a temp folder with the right structure during the build &#8211;&gt;<br />
&lt;property name=&#8221;temp.dir&#8221; value=&#8221;temp&#8221; /&gt;<br />
&lt;property name=&#8221;temp.dir.web-inf&#8221; value=&#8221;${temp.dir}/WEB-INF&#8221; /&gt;<br />
&lt;property name=&#8221;temp.dir.lib&#8221; value=&#8221;${temp.dir.web-inf}/lib&#8221; /&gt;<br />
&lt;property name=&#8221;temp.dir.classes&#8221; value=&#8221;${temp.dir.web-inf}/classes&#8221; /&gt;<br />
&lt;property name=&#8221;temp.dir.meta-inf&#8221; value=&#8221;${temp.dir}/META-INF&#8221; /&gt;</p>
<p>&lt;property name=&#8221;package.file&#8221; value=&#8221;${dest.dir}/${package.name}&#8221; /&gt;</p>
<p>&lt;path id=&#8221;build.class.path&#8221;&gt;<br />
&lt;fileset dir=&#8221;lib&#8221;&gt;<br />
&lt;include name=&#8221;**/*.jar&#8221; /&gt;<br />
&lt;/fileset&gt;<br />
&lt;/path&gt;</p>
<p>&lt;target name=&#8221;clean&#8221;&gt;<br />
&lt;delete&gt;<br />
&lt;fileset dir=&#8221;${dest.dir}&#8221; includes=&#8221;**/*&#8221;/&gt;<br />
&lt;/delete&gt;<br />
&lt;delete dir=&#8221;${temp.dir}&#8221; /&gt;<br />
&lt;delete dir=&#8221;${temp.dir.classes}&#8221; /&gt;<br />
&lt;delete dir=&#8221;${temp.dir.meta-inf}&#8221; /&gt;<br />
&lt;delete dir=&#8221;${temp.dir.web-inf}&#8221; /&gt;<br />
&lt;/target&gt;</p>
<p>&lt;target name=&#8221;prepare&#8221; depends=&#8221;clean&#8221;&gt;<br />
&lt;mkdir dir=&#8221;${dest.dir}&#8221; /&gt;<br />
&lt;mkdir dir=&#8221;${temp.dir}&#8221; /&gt;<br />
&lt;mkdir dir=&#8221;${temp.dir.lib}&#8221; /&gt;<br />
&lt;mkdir dir=&#8221;${temp.dir.meta-inf}&#8221; /&gt;<br />
&lt;mkdir dir=&#8221;${temp.dir.web-inf}&#8221; /&gt;<br />
&lt;mkdir dir=&#8221;${temp.dir.classes}&#8221; /&gt;<br />
&lt;/target&gt;</p>
<p>&lt;!&#8211; COMPILE &#8211;&gt;<br />
&lt;target name=&#8221;compile&#8221; depends=&#8221;prepare&#8221;&gt;<br />
&lt;echo&gt;=== COMPILE ===&lt;/echo&gt;<br />
&lt;echo&gt;Compiling ${src.dir} files &#8230;&lt;/echo&gt;<br />
&lt;javac debug=&#8221;on&#8221; srcdir=&#8221;${src.dir}&#8221; destdir=&#8221;${temp.dir.classes}&#8221; includes=&#8221;**/*&#8221;&gt;<br />
&lt;classpath refid=&#8221;build.class.path&#8221; /&gt;<br />
&lt;/javac&gt;</p>
<p>&lt;!&#8211; compile files on the src-tests path &#8211;&gt;<br />
&lt;echo&gt;Compiling ${src.tests.dir} files &#8230;&lt;/echo&gt;<br />
&lt;javac debug=&#8221;on&#8221; srcdir=&#8221;${src.tests.dir}&#8221; destdir=&#8221;${temp.dir.classes}&#8221; includes=&#8221;com/**&#8221;&gt;<br />
&lt;classpath refid=&#8221;build.class.path&#8221; /&gt;<br />
&lt;/javac&gt;<br />
&lt;/target&gt;</p>
<p>&lt;!&#8211; PACKAGE &#8211;&gt;<br />
&lt;target name=&#8221;package&#8221; depends=&#8221;compile&#8221;&gt;<br />
&lt;echo&gt;=== PACKAGE ===&lt;/echo&gt;</p>
<p>&lt;!&#8211; copy the config files &#8211;&gt;<br />
&lt;copy file=&#8221;${resources.dir}/MANIFEST.MF&#8221; tofile=&#8221;${temp.dir.meta-inf}/MANIFEST.MF&#8221; overwrite=&#8221;true&#8221; /&gt;<br />
&lt;copy file=&#8221;${resources.dir}/web.xml&#8221; tofile=&#8221;${temp.dir.web-inf}/web.xml&#8221; overwrite=&#8221;true&#8221; /&gt;<br />
&lt;copy file=&#8221;${resources.dir}/managed-beans.xml&#8221; tofile=&#8221;${temp.dir.web-inf}/managed-beans.xml&#8221; overwrite=&#8221;true&#8221; /&gt;<br />
&lt;copy file=&#8221;${resources.dir}/navigation-rules.xml&#8221; tofile=&#8221;${temp.dir.web-inf}/navigation-rules.xml&#8221; overwrite=&#8221;true&#8221; /&gt;</p>
<p>&lt;copy todir=&#8221;${temp.dir.classes}&#8221;&gt;<br />
&lt;fileset dir=&#8221;${src.dir}&#8221;&gt;<br />
&lt;include name=&#8221;**/*.xml&#8221;/&gt;<br />
&lt;include name=&#8221;**/*.xsl&#8221;/&gt;<br />
&lt;/fileset&gt;<br />
&lt;/copy&gt;</p>
<p>&lt;!&#8211; with all resources in place, create the war file &#8211;&gt;<br />
&lt;war destfile=&#8221;${package.file}&#8221; webxml=&#8221;${temp.dir.web-inf}/web.xml&#8221; basedir=&#8221;${temp.dir}&#8221;&gt;<br />
&lt;fileset dir=&#8221;${pages.dir}&#8221;/&gt;<br />
&lt;lib dir=&#8221;${lib.dir}&#8221; /&gt;<br />
&lt;classes dir=&#8221;${temp.dir.classes}&#8221; /&gt;<br />
&lt;/war&gt;<br />
&lt;/target&gt;</p>
<p>&lt;!&#8211; JUST DEPLOY JSP&#8217;s &#8211;&gt;<br />
&lt;target name=&#8221;jsps&#8221;&gt;<br />
&lt;echo&gt;=== DEPLOY JSP&#8217;S ===&lt;/echo&gt;<br />
&lt;!&#8211; i&#8217;m trying to be explicit about what i put out there &#8211;&gt;<br />
&lt;copy todir=&#8221;${webapp.dir}/${jsp.dir.name}&#8221;&gt;<br />
&lt;fileset dir=&#8221;${pages.dir}&#8221;&gt;<br />
&lt;include name=&#8221;**/*.jsp&#8221;/&gt;<br />
&lt;include name=&#8221;**/*.html&#8221;/&gt;<br />
&lt;include name=&#8221;**/*.css&#8221;/&gt;<br />
&lt;include name=&#8221;**/*.gif&#8221;/&gt;<br />
&lt;include name=&#8221;**/*.jpg&#8221;/&gt;<br />
&lt;include name=&#8221;**/*.png&#8221;/&gt;<br />
&lt;include name=&#8221;**/*.js&#8221;/&gt;<br />
&lt;/fileset&gt;<br />
&lt;/copy&gt;<br />
&lt;/target&gt;</p>
<p>&lt;!&#8211; INSTALL &#8211;&gt;<br />
&lt;target name=&#8221;install&#8221; depends=&#8221;package&#8221;&gt;<br />
&lt;echo&gt;=== INSTALL ===&lt;/echo&gt;<br />
&lt;copy file=&#8221;${package.file}&#8221; tofile=&#8221;${webapp.dir}/${package.name}&#8221; overwrite=&#8221;true&#8221; /&gt;<br />
&lt;/target&gt;</p>
<p>&lt;/project&gt;</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/a-sample-ant-build-script-that-builds-a-war-file/">A sample Ant build script that builds a WAR file &#8211;  Guide</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/a-sample-ant-build-script-that-builds-a-war-file/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
