build.xml 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. <?xml version="1.0"?>
  2. <!--
  3. * Copyright 2004 Acegi Technology Pty Limited
  4. *
  5. * Licensed under the Apache License, Version 2.0 (the "License");
  6. * you may not use this file except in compliance with the License.
  7. * You may obtain a copy of the License at
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS,
  13. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. *
  17. *
  18. * $Id$
  19. -->
  20. <!--
  21. Build file for the "contacts" sample application.
  22. -->
  23. <project name="contacts-sample" basedir="." default="usage">
  24. <property file="build.properties"/>
  25. <property file="project.properties"/>
  26. <path id="qa-portalpath">
  27. <fileset dir="${dist.lib.dir}">
  28. <include name="acegi-security.jar"/>
  29. </fileset>
  30. <fileset dir="${lib.dir}">
  31. <include name="**/**.jar"/>
  32. </fileset>
  33. </path>
  34. <path id="jalopy-classpath">
  35. <fileset dir="${lib.dir}/jalopy">
  36. <include name="**/*.jar"/>
  37. </fileset>
  38. </path>
  39. <target name="usage">
  40. <echo message=""/>
  41. <echo message="Contacts sample application build file"/>
  42. <echo message="*** Make sure you've followed the instructions for your container in the reference documentation."/>
  43. <echo message="------------------------------------------------------"/>
  44. <echo message=""/>
  45. <echo message="Available targets are:"/>
  46. <echo message=""/>
  47. <echo message="clean --> Clean output dirs"/>
  48. <echo message="build --> Compile main Java sources and copy libraries"/>
  49. <echo message="warfile --> Create WAR deployment units"/>
  50. <echo message="javadoc --> Create API documentation"/>
  51. <echo message=""/>
  52. </target>
  53. <target name="clean" description="Clean output dirs (build, dist)">
  54. <delete dir="${build.dir}"/>
  55. <delete dir="${dist.dir}"/>
  56. <delete dir="${war.dir}/WEB-INF/lib"/>
  57. </target>
  58. <target name="build" description="Compile main source tree java files into class files">
  59. <mkdir dir="${build.dir}"/>
  60. <javac destdir="${build.dir}" target="1.3" debug="true" deprecation="false"
  61. optimize="false" failonerror="true">
  62. <src path="${src.dir}"/>
  63. <classpath refid="qa-portalpath"/>
  64. </javac>
  65. <copy todir="${build.dir}">
  66. <fileset dir="${src.dir}">
  67. <include name="*.properties"/>
  68. </fileset>
  69. </copy>
  70. </target>
  71. <target name="format" description="Formats all project source code">
  72. <taskdef name="jalopy" classname="de.hunsicker.jalopy.plugin.ant.AntPlugin">
  73. <classpath refid="jalopy-classpath"/>
  74. </taskdef>
  75. <jalopy fileformat="unix"
  76. convention="${jalopy.xml}"
  77. history="file"
  78. historymethod="adler32"
  79. loglevel="error"
  80. threads="2"
  81. classpathref="qa-portalpath">
  82. <fileset dir="${src.dir}">
  83. <include name="**/*.java"/>
  84. </fileset>
  85. </jalopy>
  86. </target>
  87. <target name="warfile" depends="build" description="Build the web application archives">
  88. <mkdir dir="${dist.dir}"/>
  89. <delete dir="${tmp.dir}"/>
  90. <!-- Make WAR suitable for deployment into containers WITHOUT container adapters -->
  91. <delete file="${dist.dir}/${name.filter}.war"/>
  92. <mkdir dir="${tmp.dir}/${name.filter}"/>
  93. <copy todir="${tmp.dir}/${name.filter}">
  94. <fileset dir="${war.dir}">
  95. <include name="**"/>
  96. </fileset>
  97. <fileset dir="${etc.dir}/filter">
  98. <include name="acegilogin.jsp"/>
  99. </fileset>
  100. </copy>
  101. <copy todir="${tmp.dir}/${name.filter}/classes">
  102. <fileset dir="${build.dir}">
  103. <include name="**"/>
  104. </fileset>
  105. <fileset dir="${etc.dir}/filter">
  106. <include name="web-filters-acegisecurity.xml"/>
  107. </fileset>
  108. </copy>
  109. <copy todir="${tmp.dir}/${name.filter}/WEB-INF">
  110. <fileset dir="${etc.dir}/filter">
  111. <include name="web.xml"/>
  112. </fileset>
  113. </copy>
  114. <war warfile="${dist.dir}/${name.filter}.war" webxml="${tmp.dir}/${name.filter}/WEB-INF/web.xml">
  115. <!-- Include the files which are not under WEB-INF -->
  116. <fileset dir="${tmp.dir}/${name.filter}">
  117. <exclude name="WEB-INF/**"/>
  118. <exclude name="classes/**"/>
  119. </fileset>
  120. <!-- Bring in various XML configuration files -->
  121. <webinf dir="${tmp.dir}/${name.filter}/WEB-INF">
  122. <exclude name="web.xml"/>
  123. </webinf>
  124. <!-- Include the compiled classes -->
  125. <classes dir="${tmp.dir}/${name.filter}/classes"/>
  126. <!-- Include required libraries -->
  127. <lib dir="${lib.dir}/jakarta-taglibs" includes="*.jar"/>
  128. <lib dir="${lib.dir}/spring" includes="spring.jar"/>
  129. <lib dir="${lib.dir}/aop-alliance" includes="aopalliance.jar"/>
  130. <lib dir="${lib.dir}/regexp" includes="jakarta-oro.jar"/>
  131. <lib dir="${lib.dir}/j2ee" includes="jstl.jar"/>
  132. <lib dir="${dist.lib.dir}" includes="acegi-security-taglib.jar"/>
  133. <lib dir="${dist.lib.dir}" includes="acegi-security.jar"/>
  134. </war>
  135. <!-- Make WAR suitable for deployment into containers WITH container adapters -->
  136. <delete file="${dist.dir}/${name.ca}.war"/>
  137. <mkdir dir="${tmp.dir}/${name.ca}"/>
  138. <copy todir="${tmp.dir}/${name.ca}">
  139. <fileset dir="${war.dir}">
  140. <include name="**"/>
  141. </fileset>
  142. <fileset dir="${etc.dir}/ca">
  143. <include name="login.jsp"/>
  144. </fileset>
  145. </copy>
  146. <copy todir="${tmp.dir}/${name.ca}/classes">
  147. <fileset dir="${build.dir}">
  148. <include name="**"/>
  149. </fileset>
  150. <fileset dir="${etc.dir}/ca">
  151. <include name="resin-acegisecurity.xml"/>
  152. </fileset>
  153. </copy>
  154. <copy todir="${tmp.dir}/${name.ca}/WEB-INF">
  155. <fileset dir="${etc.dir}/ca">
  156. <include name="jboss-web.xml"/>
  157. <include name="resin-web.xml"/>
  158. <include name="web.xml"/>
  159. </fileset>
  160. </copy>
  161. <war warfile="${dist.dir}/${name.ca}.war" webxml="${tmp.dir}/${name.ca}/WEB-INF/web.xml">
  162. <!-- Include the files which are not under WEB-INF -->
  163. <fileset dir="${tmp.dir}/${name.ca}">
  164. <exclude name="WEB-INF/**"/>
  165. <exclude name="classes/**"/>
  166. </fileset>
  167. <!-- Bring in various XML configuration files -->
  168. <webinf dir="${tmp.dir}/${name.ca}/WEB-INF">
  169. <exclude name="web.xml"/>
  170. </webinf>
  171. <!-- Include the compiled classes -->
  172. <classes dir="${tmp.dir}/${name.ca}/classes"/>
  173. <!-- Include required libraries -->
  174. <lib dir="${lib.dir}/jakarta-taglibs" includes="*.jar"/>
  175. <lib dir="${lib.dir}/j2ee" includes="jstl.jar"/>
  176. <lib dir="${dist.lib.dir}" includes="acegi-security-taglib.jar"/>
  177. </war>
  178. </target>
  179. <target name="javadoc" description="Generate Javadocs.">
  180. <mkdir dir="${javadocs.dir}"/>
  181. <javadoc sourcepath="src" destdir="${javadocs.dir}" windowtitle="Contact Sample Application"
  182. defaultexcludes="yes" author="true" version="true" use="true">
  183. <doctitle><![CDATA[<h1>Acegi Security System for Spring Contacts Sample</h1>]]></doctitle>
  184. <bottom><![CDATA[<A HREF="http://acegisecurity.sourceforge.net">Acegi Security System for Spring Project]]></bottom>
  185. <classpath refid="qa-portalpath"/>
  186. <packageset dir="${src.dir}">
  187. <include name="sample/contact/**"/>
  188. </packageset>
  189. </javadoc>
  190. </target>
  191. <target name="release" depends="clean,warfile,javadoc" description="Builds a clean release file"/>
  192. </project>