authserver/casserver/simple-cas4-overlay-template/build.xml
changeset 0 1afc9d2ab94d
equal deleted inserted replaced
-1:000000000000 0:1afc9d2ab94d
       
     1 <?xml version="1.0" encoding="UTF-8"?>
       
     2 <!--
       
     3 
       
     4     Licensed to Jasig under one or more contributor license
       
     5     agreements. See the NOTICE file distributed with this work
       
     6     for additional information regarding copyright ownership.
       
     7     Jasig licenses this file to you under the Apache License,
       
     8     Version 2.0 (the "License"); you may not use this file
       
     9     except in compliance with the License.  You may obtain a
       
    10     copy of the License at the following location:
       
    11 
       
    12       http://www.apache.org/licenses/LICENSE-2.0
       
    13 
       
    14     Unless required by applicable law or agreed to in writing,
       
    15     software distributed under the License is distributed on an
       
    16     "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
       
    17     KIND, either express or implied.  See the License for the
       
    18     specific language governing permissions and limitations
       
    19     under the License.
       
    20 
       
    21 -->
       
    22 <project name="cas" default="deploy" basedir=".">
       
    23 
       
    24 	<!-- ******************* PROPERTIES ************************* -->
       
    25 	<property environment="env" />
       
    26 	<property name="build.target.dir" value="target" />
       
    27 	
       
    28 	<property name="catalina.home" value="${env.CATALINA_HOME}" />
       
    29 	<property name="tomcat.log.patterns" value="**/*.log, **/*.txt" />
       
    30 	<taskdef resource="net/sf/antcontrib/antcontrib.properties" />
       
    31 	<property name="cas.resources.dir" value="/etc/cas" />
       
    32 	
       
    33 	<!-- ******************* MAVEN PROPERTIES******************** -->
       
    34 	<condition property="mavenExecutableFile" value="mvn.bat" else="mvn">
       
    35 		<os family="windows" />
       
    36 	</condition>
       
    37 	<var name="mavenExecutable" value="${env.M2_HOME}\bin\${mavenExecutableFile}"/>
       
    38 	<available file="${mavenExecutable}"  property="maven.exec.exists" />
       
    39 
       
    40 	<if>
       
    41 		<not>
       
    42 			<isset property="${maven.exec.exists}" />
       
    43 		</not>
       
    44 		<then>
       
    45 			<var name="mavenExecutable" value="${env.MAVEN_HOME}\bin\${mavenExecutableFile}"/>
       
    46 			<available file="${mavenExecutable}"  property="maven.exec.exists" />
       
    47 		</then>
       
    48 	</if>
       
    49 	<fail unless="${maven.exec.exists}" message="Cannot determine the maven installation location through M2_HOME or MAVEN_HOME environment variables."/>
       
    50 		
       
    51 	<!-- ***************** TOMCAT PROPERTIES ******************** -->
       
    52 	<condition property="tomcatStartupFile" value="startup.bat" else="startup">
       
    53 		<os family="windows" />
       
    54 	</condition>
       
    55 	<property name="tomcatStartup" value="${catalina.home}\bin\${tomcatStartupFile}" />
       
    56 
       
    57 	<condition property="tomcatShutDownFile" value="shutdown.bat" else="shutdown">
       
    58 		<os family="windows" />
       
    59 	</condition>
       
    60 	<property name="tomcatShutDown" value="${catalina.home}\bin\${tomcatShutDownFile}" />
       
    61 	
       
    62 	<!-- ********************* TARGETS *************************** -->
       
    63 	<target name="cleanTomcatLogs" description="Clean tomcat log files">
       
    64 		<delete failonerror="false">
       
    65 			<fileset dir="${catalina.home}/logs" includes="${tomcat.log.patterns}" />
       
    66 			<fileset dir="${catalina.home}/bin" includes="${tomcat.log.patterns}" />
       
    67 			<fileset dir="${catalina.home}" includes="${tomcat.log.patterns}" />
       
    68 		</delete>
       
    69 	</target>
       
    70 
       
    71 	<target name="clean" description="Clean deployed artifacts and logs">
       
    72 		<delete file="${catalina.home}/webapps/${ant.project.name}.war" verbose="false" failonerror="true" />
       
    73 		<delete file="${catalina.home}\conf\Catalina\localhost\cas.xml" verbose="false" failonerror="true" />
       
    74 		<delete file="${catalina.home}/bin/${ant.project.name}.log" verbose="false" failonerror="true" />
       
    75 		
       
    76 		<delete dir="${catalina.home}/webapps/${ant.project.name}" verbose="false" includeemptydirs="true" failonerror="true" />
       
    77 		<delete file="${catalina.home}/webapps/cas-management.war" verbose="false" includeemptydirs="true" failonerror="true" />
       
    78 		<delete dir="${catalina.home}/webapps/cas-management" verbose="false" includeemptydirs="true" failonerror="true" />
       
    79 		<delete dir="/etc/cas/log" verbose="false" includeemptydirs="true" failonerror="true" />
       
    80 
       
    81 		<delete dir="${catalina.home}/work/Catalina" verbose="false" includeemptydirs="true"  failonerror="true"/>
       
    82 
       
    83 
       
    84 		<exec dir="${basedir}" executable="${mavenExecutable}">
       
    85 			<arg value="clean" />
       
    86 			<arg value="-Dmaven.test.skip=true" />
       
    87 		</exec>
       
    88 		<antcall target="cleanTomcatLogs" />
       
    89 	</target>
       
    90 
       
    91 	<target name="compile" description="Compile artifacts" depends="clean">
       
    92 		<exec dir="${basedir}" executable="${mavenExecutable}">
       
    93       		<arg value="compile" />
       
    94 			<arg value="-Dmaven.test.skip=true" />
       
    95 		</exec>
       
    96 	</target>
       
    97 
       
    98 	<target name="test" description="Compile artifacts and run tests" depends="clean">
       
    99 		<exec dir="${basedir}" executable="${mavenExecutable}">
       
   100 			<arg value="test" />
       
   101 		</exec>
       
   102 	</target>
       
   103 
       
   104 	<target name="copy" description="Copy artifacts over to tomcat" depends="package">
       
   105 		<copy overwrite="true"
       
   106 		      todir="${catalina.home}\webapps"
       
   107 		      file="target/${ant.project.name}.war"
       
   108 			  verbose="true"
       
   109 		/>
       
   110 
       
   111 		<mkdir dir="${cas.resources.dir}" />
       
   112 		<copy overwrite="true" verbose="true" todir="${cas.resources.dir}" flatten="true">
       
   113 			<fileset dir="${basedir}/etc" includes="*.conf" />
       
   114 		</copy>
       
   115 		<copy overwrite="true" verbose="true" todir="${cas.resources.dir}" flatten="true">
       
   116 			<fileset dir="${basedir}/etc" includes="*.xml" />
       
   117 		</copy>
       
   118 		<copy overwrite="true" verbose="true" todir="${cas.resources.dir}" flatten="true">
       
   119 			<fileset dir="${basedir}/etc" includes="*.properties" />
       
   120 		</copy>
       
   121 
       
   122 	</target>
       
   123 
       
   124 	<target name="package" description="Package src artifacts and prepare for deployment" depends="clean">
       
   125 		<exec dir="${basedir}" executable="${mavenExecutable}">
       
   126 			<arg value="install" />
       
   127 			<arg value="-Dmaven.test.skip=true" />
       
   128 		</exec>
       
   129 	</target>
       
   130 
       
   131 
       
   132 	<target name="deploy" depends="copy" description="Clean, package and deploy artifacts" />
       
   133 
       
   134 	<target name="help" description="Prints instructions on how to run the build.">
       
   135 		<echo message="Use 'ant -projecthelp' to see all available commands" />
       
   136 	</target>
       
   137 
       
   138 </project>
       
   139