{"id":187,"date":"2012-08-02T15:00:10","date_gmt":"2012-08-02T19:00:10","guid":{"rendered":"https:\/\/jeremystein.com\/brain\/?p=187"},"modified":"2012-08-02T15:08:24","modified_gmt":"2012-08-02T19:08:24","slug":"simple-build-xml-file-for-java-web-application","status":"publish","type":"post","link":"https:\/\/jeremystein.com\/brain\/simple-build-xml-file-for-java-web-application\/","title":{"rendered":"Simple build.xml file for Java web application"},"content":{"rendered":"<p>For future reference, here&#8217;s the build.xml for a simple webapp:<\/p>\n<pre>&lt;project name=\"NAME_OF_PROJECT\" default=\"compile\" basedir=\".\"&gt;\r\n  &lt;description&gt;\r\n    DESCRIPTION OF PROJECT\r\n  &lt;\/description&gt;\r\n\r\n  &lt;!--\r\n    build.properties should define:\r\n    J2EE_LIBRARY_PATH - generally just points to the tomcat common\/lib\r\n    BUILD_PATH - where to build files (optional)\r\n  --&gt;\r\n  &lt;property file=\"build.properties\"\/&gt;\r\n  &lt;property name=\"BUILD_PATH\" location=\"build\"\/&gt;\r\n\r\n  &lt;target name=\"compile\" description=\"compile the source\"&gt;\r\n    &lt;mkdir dir=\"${BUILD_PATH}\"\/&gt;\r\n    &lt;copy todir=\"${BUILD_PATH}\/webapp\"&gt;\r\n      &lt;fileset dir=\"web\" \/&gt;\r\n    &lt;\/copy&gt;\r\n    &lt;mkdir dir=\"${BUILD_PATH}\/webapp\/WEB-INF\/lib\"\/&gt;\r\n    &lt;copy todir=\"${BUILD_PATH}\/webapp\/WEB-INF\/lib\"&gt;\r\n      &lt;fileset dir=\"lib\" excludes=\"**\/*.zip\"\/&gt;\r\n    &lt;\/copy&gt;\r\n    &lt;mkdir dir=\"${BUILD_PATH}\/webapp\/WEB-INF\/classes\"\/&gt;\r\n    &lt;javac srcdir=\"src\" destdir=\"${BUILD_PATH}\/webapp\/WEB-INF\/classes\" debug=\"true\" debuglevel=\"lines,vars,source\" source=\"1.5\" target=\"1.5\"&gt;\r\n      &lt;classpath&gt;\r\n        &lt;fileset dir=\"lib\" \/&gt;\r\n        &lt;fileset dir=\"${J2EE_LIBRARY_PATH}\" \/&gt;\r\n      &lt;\/classpath&gt;\r\n      &lt;include name=\"**\/*.java\"\/&gt;\r\n    &lt;\/javac&gt;\r\n    &lt;copy todir=\"${BUILD_PATH}\/webapp\/WEB-INF\/classes\"&gt;\r\n      &lt;fileset dir=\"src\" excludes=\"**\/*.java\"\/&gt;\r\n    &lt;\/copy&gt;\r\n  &lt;\/target&gt;\r\n\r\n  &lt;target name=\"dist\" depends=\"compile\" description=\"generate the distribution\"&gt;\r\n    &lt;zip destfile=\"${BUILD_PATH}\/NAME_OF_PROJECT.war\" basedir=\"${BUILD_PATH}\/webapp\" \/&gt;\r\n  &lt;\/target&gt;\r\n\r\n  &lt;target name=\"clean\" description=\"remove all generated files\"&gt;\r\n    &lt;delete includeemptydirs=\"true\"&gt;\r\n      &lt;fileset dir=\"${BUILD_PATH}\" includes=\"*\/**\"\/&gt;\r\n    &lt;\/delete&gt;\r\n  &lt;\/target&gt;\r\n&lt;\/project&gt;<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>For future reference, here&#8217;s the build.xml for a simple webapp: &lt;project name=&#8221;NAME_OF_PROJECT&#8221; default=&#8221;compile&#8221; basedir=&#8221;.&#8221;&gt; &lt;description&gt; DESCRIPTION OF PROJECT &lt;\/description&gt; &lt;!&#8211; build.properties should define: J2EE_LIBRARY_PATH &#8211; generally just points to the tomcat common\/lib BUILD_PATH &#8211; where to build files (optional) &#8211;&gt; &lt;property file=&#8221;build.properties&#8221;\/&gt; &lt;property name=&#8221;BUILD_PATH&#8221; location=&#8221;build&#8221;\/&gt; &lt;target name=&#8221;compile&#8221; description=&#8221;compile the source&#8221;&gt; &lt;mkdir dir=&#8221;${BUILD_PATH}&#8221;\/&gt; &lt;copy todir=&#8221;${BUILD_PATH}\/webapp&#8221;&gt; &lt;fileset [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[33],"tags":[],"class_list":["post-187","post","type-post","status-publish","format-standard","hentry","category-java"],"_links":{"self":[{"href":"https:\/\/jeremystein.com\/brain\/wp-json\/wp\/v2\/posts\/187","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jeremystein.com\/brain\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jeremystein.com\/brain\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jeremystein.com\/brain\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jeremystein.com\/brain\/wp-json\/wp\/v2\/comments?post=187"}],"version-history":[{"count":0,"href":"https:\/\/jeremystein.com\/brain\/wp-json\/wp\/v2\/posts\/187\/revisions"}],"wp:attachment":[{"href":"https:\/\/jeremystein.com\/brain\/wp-json\/wp\/v2\/media?parent=187"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jeremystein.com\/brain\/wp-json\/wp\/v2\/categories?post=187"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jeremystein.com\/brain\/wp-json\/wp\/v2\/tags?post=187"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}