blob: eaeb2d043003fe3eec071bd4b7567216a4a97bb9 [file] [log] [blame]
<!--
~ This work is part of OpenLDAP Software <http://www.openldap.org/>.
~
~ Copyright 1998-2014 The OpenLDAP Foundation.
~ All rights reserved.
~
~ Redistribution and use in source and binary forms, with or without
~ modification, are permitted only as authorized by the OpenLDAP
~ Public License.
~
~ A copy of this license is available in the file LICENSE in the
~ top-level directory of the distribution or, alternatively, at
~ <http://www.OpenLDAP.org/license.html>.
-->
<project name="fortress-sentry" default="build" basedir="." xmlns:ivy="antlib:org.apache.ivy.ant"
xmlns:artifact="antlib:org.apache.maven.artifact.ant">
<target name="init">
<!-- read properties from the build.properties, if any -->
<property name="component-propfile" value="${basedir}/build.properties"/>
<property file="${component-propfile}"/>
<!-- read properties from the ${user.home}/propfile, if any -->
<property name="user-propfile" value="${user.home}/build.properties"/>
<property file="${user-propfile}"/>
<property name="project.name" value="Fortress Java Sentry"/>
<property name="name" value="fortressSentry"/>
<property name="title" value="Fortress Java Sentry ${version}"/>
<property name="vendor" value="Joshua Tree Software"/>
<property name="package" value="org.openldap.sentry.*"/>
<property name="ivy.install.version" value="2.2.0"/>
<!-- Env vars -->
<property name="src.dir" value="${basedir}/src"/>
<property name="lib.dir" value="${basedir}/lib"/>
<property name="config.dir" value="${basedir}/conf"/>
<property name="src.java.dir" value="${src.dir}/main/java"/>
<property name="src.java.proxy.dir" value="${src.java.dir}/proxy"/>
<property name="src.java.impl.dir" value="${src.java.dir}/impl"/>
<property name="build.dir" value="${basedir}/build"/>
<property name="build.classes.dir" value="${build.dir}/classes"/>
<property name="build.classes.proxy.dir" value="${build.classes.dir}/proxy"/>
<property name="build.classes.impl.dir" value="${build.classes.dir}/impl"/>
<property name="dist.dir" value="${basedir}/dist"/>
<property name="work.base.dir" value="${build.dir}/work"/>
<property name="work.dir" value="${work.base.dir}/dflt"/>
<property name="work.jboss.dir" value="${work.base.dir}/jb"/>
<property name="src.dist.zip" value="${dist.dir}/${name}Src-${version}.zip"/>
<property name="dst.remote.conf" value="${config.dir}/fortress.properties"/>
<property name="src.remote.conf" value="${config.dir}/fortress.properties.src"/>
<!-- config.suffix has a '\' which is required for commons configuration utility -->
<property name="config.suffix" value="dc=${suffix.name}\,dc=com"/>
<!-- Build artifacts -->
<property name="fortressTomcatSentry.jar" value="${dist.dir}/fortressProxyTomcat-${version}.jar"/>
<property name="fortressTomcat7Sentry.jar" value="${dist.dir}/fortressProxyTomcat7-${version}.jar"/>
<property name="fortressSentry.jar" value="${dist.dir}/fortressSentry-${version}.jar"/>
<property name="fortressSentry.zip" value="${dist.dir}/fortressSentryDist-${version}.zip"/>
<property name="fortressSentryDistro.jar" value="${dist.dir}/fortressSentry-${version}.jar"/>
<property name="fortressJbossSentryDistro.jar" value="${dist.dir}/fortressSentryJBoss-${version}.jar"/>
<property name="fortressSentryImpl.jar" value="${dist.dir}/fortressSentryImpl-${version}.jar"/>
<property name="javadoc.dist.zip" value="${dist.dir}/fortressSentryDoc-${version}.zip"/>
<property name="fortressSentryBuilder.zip" value="${dist.dir}/fortressSentryBuilder-${version}.zip"/>
<property name="realm-impl.jar" value="${dist.dir}/fortressSentryImpl-${version}.jar"/>
<property name="realm-proxy.jar" value="${dist.dir}/fortressProxyTomcat7-${version}.jar"/>
<property name="config.dir" value="${basedir}/conf"/>
<!-- Dependent LIBs in maven -->
<property name="fortress.jar" value="${lib.dir}/fortress-${version}.jar"/>
<property name="catalina7.jar" value="${lib.dir}/tomcat-catalina-7.0.22.jar"/>
<property name="catalina.jar" value="${lib.dir}/catalina-6.0.33.jar"/>
<property name="commons-config.jar" value="${lib.dir}/commons-configuration-1.6.jar"/>
<property name="commons-lang.jar" value="${lib.dir}/commons-lang-2.4.jar"/>
<property name="commons-collections.jar" value="${lib.dir}/commons-collections-3.2.1.jar"/>
<property name="commons-pool.jar" value="${lib.dir}/commons-pool-1.5.2.jar"/>
<property name="commons-logging.jar" value="${lib.dir}/commons-logging-1.1.1.jar"/>
<property name="unboundsdk.jar" value="${lib.dir}/unboundid-ldapsdk-2.1.0.jar"/>
<property name="jgraph.jar" value="${lib.dir}/jgrapht-jdk1.5-0.7.3.jar"/>
<property name="log4j.jar" value="${lib.dir}/log4j-1.2.17.jar"/>
<property name="jasypt.jar" value="${lib.dir}/jasypt-1.8.jar"/>
<property name="ehcache-core.jar" value="${lib.dir}/ehcache-core-2.6.9.jar"/>
<property name="slf4j-api.jar" value="${lib.dir}/slf4j-api-1.7.5.jar"/>
<property name="slf4j-jcl.jar" value="${lib.dir}/slf4j-jcl-1.7.5.jar"/>
<property name="apacheds-all.jar" value="${lib.dir}/apacheds-all-2.0.0-M15.jar"/>
<!-- ########### Define classpaths ########################### -->
<path id="build.proxy.class.path">
<!-- J2EE JARs -->
<pathelement location="${catalina.jar}"/>
</path>
<path id="build.proxy.tc7.class.path">
<!-- J2EE JARs -->
<pathelement location="${catalina7.jar}"/>
</path>
<path id="build.impl.class.path">
<!-- J2EE JARs -->
<pathelement location="${catalina.jar}"/>
<!-- Fortress JARs -->
<pathelement location="${build.classes.proxy.dir}"/>
<pathelement location="${fortress.jar}"/>
<pathelement location="${log4j.jar}"/>
</path>
<!-- JARS required for distribution -->
<patternset id="dist.libs">
<include name="${fortress.jar}"/>
<include name="${log4j.jar}"/>
<include name="${commons-collections.jar}"/>
<include name="${commons-config.jar}"/>
<include name="${commons-lang.jar}"/>
<include name="${commons-logging.jar}"/>
<include name="${commons-pool.jar}"/>
<include name="${jgraph.jar}"/>
<include name="${jasypt.jar}"/>
<include name="${ehcache-core.jar}"/>
<include name="${slf4j-api.jar}"/>
<include name="${slf4j-jcl.jar}"/>
<include name="${apacheds-all.jar}"/>
</patternset>
<!-- Javadoc vars -->
<property name="javadoc.dir" value="${dist.dir}/docs/api"/>
<property name="javadoc.images.dir" value="${javadoc.dir}/images"/>
<property name="javadoc.bottom"
value="&lt;small&gt;Copyright &amp;copy; 1998-2014, The OpenLDAP Foundation. All Rights Reserved."/>
<property name="javadoc.overview" value="${src.java.dir}/overview.html"/>
<property name="javadoc.stylesheet" value="${src.java.dir}/fortress-javadoc.css"/>
<path id="javadoc.source.path">
<pathelement location="${src.java.proxy.dir}"/>
<pathelement location="${src.java.impl.dir}"/>
</path>
<property name="javac.optimize" value="false"/>
<property name="javac.debug" value="true"/>
<property name="javac.deprecation" value="true"/>
<!-- Presetdef to create jar with common manifest -->
<presetdef name="fortressSentry.jar">
<jar compress="true">
<manifest>
<attribute name="Created-By" value="${vendor} - ${project.name} dev team"/>
<attribute name="Implementation-Vendor" value="${vendor}"/>
<attribute name="Implementation-Version" value="${version}"/>
<attribute name="Specification-Title" value="${title}"/>
<attribute name="Package" value="${package}"/>
<attribute name="Extension-Name" value="${name}"/>
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Compile-JDK" value="${java.runtime.version}"/>
<attribute name="Test-VM" value="${java.vm.version}"/>
</manifest>
</jar>
</presetdef>
<!-- define Maven coordinates (publishing only) -->
<property name="groupId" value="org.openldap"/>
<property name="artifactId" value="sentry"/>
<!-- defined maven snapshots and staging repository id and url (publishing only) -->
<property name="maven-snapshots-repository-id" value="sonatype-nexus-snapshots"/>
<property name="maven-snapshots-repository-url"
value="https://oss.sonatype.org/content/repositories/snapshots"/>
<property name="maven-staging-repository-id" value="sonatype-nexus-staging"/>
<property name="maven-staging-repository-url"
value="https://oss.sonatype.org/service/local/staging/deploy/maven2"/>
<!-- define artifacts' name, which follows the convention of Maven (publishing only) -->
<property name="maven-jar" value="${fortressSentryBuilder.zip}"/>
<property name="maven-javadoc-jar" value="${javadoc.dist.zip}"/>
<property name="maven-sources-jar" value="${src.dist.zip}"/>
</target>
<!-- =================================
target: download-ivy - pulls down ivy.jar from maven 2 website
================================= -->
<target name="download-ivy" depends="init" unless="local.mode">
<!-- download from web site so that it can be used even without any special installation -->
<echo message="downloading ivy to Ant home: ${ant.home}"/>
<get src="http://repo1.maven.org/maven2/org/apache/ivy/ivy/${ivy.install.version}/ivy-${ivy.install.version}.jar"
dest="${ant.home}/lib" usetimestamp="true"/>
</target>
<!-- =================================
target: resolve
================================= -->
<target name="resolve" depends="init,download-ivy" description="--> retreive dependencies with ivy">
<ivy:retrieve pattern="${lib.dir}/[artifact]-[revision].[ext]"/>
</target>
<!-- =================================
target: clean-cache
================================= -->
<target name="clean-cache" description="--> clean the ivy cache">
<ivy:cleancache/>
</target>
<!-- ######################################################### -->
<target name="clean" depends="init" description="removes generated files">
<delete dir="${build.dir}"/>
<delete dir="${dist.dir}"/>
</target>
<!-- ############### create javadoc ############################### -->
<target name="javadoc" depends="init" description="generates javadocs">
<mkdir dir="${javadoc.dir}"/>
<javadoc packagenames="${package}"
sourcepathref="javadoc.source.path"
destdir="${javadoc.dir}"
windowtitle="${title}"
doctitle="${title} "
bottom="${javadoc.bottom}"
overview="${javadoc.overview}"
public="true"
version="true"
author="true"
splitindex="false"
nodeprecated="true"
nodeprecatedlist="true"
notree="true"
noindex="false"
nohelp="true"
nonavbar="false"
classpathref="build.impl.class.path"
serialwarn="false">
</javadoc>
</target>
<!-- ############### compile packages ############################### -->
<target name="compile-proxy" depends="init,resolve" description="compiles proxy source files">
<mkdir dir="${build.classes.proxy.dir}"/>
<javac srcdir="${src.java.proxy.dir}"
debug="${javac.debug}"
deprecation="${javac.deprecation}"
destdir="${build.classes.proxy.dir}">
<exclude name="org/openldap/sentry/tomcat/Tc7AccessMgrProxy.java"/>
<exclude name="org/openldap/sentry/websphere/**"/>
<classpath refid="build.proxy.class.path"/>
</javac>
</target>
<target name="compile-proxy-tc7" depends="compile-proxy" description="compiles tomcat 7 proxy source files">
<javac srcdir="${src.java.proxy.dir}"
debug="${javac.debug}"
deprecation="${javac.deprecation}"
destdir="${build.classes.proxy.dir}">
<exclude name="org/openldap/sentry/tomcat/TcAccessMgrProxy.java"/>
<exclude name="org/openldap/sentry/websphere/**"/>
<classpath refid="build.proxy.tc7.class.path"/>
</javac>
</target>
<target name="compile-impl" depends="init,resolve" description="compiles impl source files">
<mkdir dir="${build.classes.impl.dir}"/>
<javac srcdir="${src.java.impl.dir}"
debug="${javac.debug}"
deprecation="${javac.deprecation}"
destdir="${build.classes.impl.dir}">
<exclude name="org/openldap/sentry/websphere/**"/>
<classpath refid="build.impl.class.path"/>
</javac>
</target>
<target name="build-jar-tcproxy" depends="compile-proxy,compile-proxy-tc7,compile-impl">
<mkdir dir="${dist.dir}"/>
<fortressSentry.jar destfile="${fortressTomcatSentry.jar}">
<fileset dir="${build.classes.proxy.dir}">
<include name="org/openldap/sentry/tomcat/**"/>
<include name="org/openldap/sentry/util/**"/>
<exclude name="org/openldap/sentry/tomcat/Tc7AccessMgrProxy.class"/>
</fileset>
<fileset dir="${build.classes.impl.dir}">
<include name="org/openldap/sentry/tomcat/TcPrincipal.class"/>
</fileset>
<metainf dir="${basedir}" includes="LICENSE.txt,NOTICE.txt"/>
</fortressSentry.jar>
</target>
<target name="build-jar-tc7proxy" depends="compile-proxy,compile-impl">
<mkdir dir="${dist.dir}"/>
<fortressSentry.jar destfile="${fortressTomcat7Sentry.jar}">
<fileset dir="${build.classes.proxy.dir}">
<include name="org/openldap/sentry/tomcat/**"/>
<include name="org/openldap/sentry/util/**"/>
<exclude name="org/openldap/sentry/tomcat/TcAccessMgrProxy.class"/>
</fileset>
<fileset dir="${build.classes.impl.dir}">
<include name="org/openldap/sentry/tomcat/TcPrincipal.class"/>
</fileset>
<metainf dir="${basedir}" includes="LICENSE.txt,NOTICE.txt"/>
</fortressSentry.jar>
</target>
<target name="build-jar-impl" depends="compile-impl">
<mkdir dir="${dist.dir}"/>
<fortressSentry.jar basedir="${build.classes.impl.dir}" destfile="${fortressSentryImpl.jar}"/>
</target>
<target name="build-jar-distro" depends="init,build-jar-impl">
<unjar dest="${work.dir}" src="${fortressSentryImpl.jar}"/>
<unjar dest="${work.dir}" src="${fortress.jar}"/>
<unjar dest="${work.dir}" src="${log4j.jar}"/>
<unjar dest="${work.dir}" src="${commons-collections.jar}"/>
<unjar dest="${work.dir}" src="${commons-config.jar}"/>
<unjar dest="${work.dir}" src="${commons-lang.jar}"/>
<unjar dest="${work.dir}" src="${commons-pool.jar}"/>
<unjar dest="${work.dir}" src="${commons-logging.jar}"/>
<unjar dest="${work.dir}" src="${unboundsdk.jar}"/>
<unjar dest="${work.dir}" src="${jgraph.jar}"/>
<unjar dest="${work.dir}" src="${jasypt.jar}"/>
<unjar dest="${work.dir}" src="${ehcache-core.jar}"/>
<unjar dest="${work.dir}" src="${slf4j-api.jar}"/>
<unjar dest="${work.dir}" src="${slf4j-jcl.jar}"/>
<fortressSentry.jar basedir="${work.dir}" compress="true" jarfile="${fortressSentryDistro.jar}"/>
</target>
<target name="build-jar-distro-jboss" depends="init,build-jar-impl">
<unjar dest="${work.jboss.dir}" src="${fortressSentryImpl.jar}"/>
<unjar dest="${work.jboss.dir}" src="${fortress.jar}"/>
<unjar dest="${work.jboss.dir}" src="${log4j.jar}"/>
<unjar dest="${work.jboss.dir}" src="${commons-collections.jar}"/>
<unjar dest="${work.jboss.dir}" src="${commons-config.jar}"/>
<unjar dest="${work.jboss.dir}" src="${commons-lang.jar}"/>
<unjar dest="${work.jboss.dir}" src="${commons-pool.jar}"/>
<unjar dest="${work.jboss.dir}" src="${commons-logging.jar}"/>
<unjar dest="${work.jboss.dir}" src="${unboundsdk.jar}"/>
<unjar dest="${work.jboss.dir}" src="${jgraph.jar}"/>
<unjar dest="${work.jboss.dir}" src="${jasypt.jar}"/>
<unjar dest="${work.jboss.dir}" src="${ehcache-core.jar}"/>
<unjar dest="${work.jboss.dir}" src="${slf4j-api.jar}"/>
<unjar dest="${work.jboss.dir}" src="${slf4j-jcl.jar}"/>
<fileset dir="${config.dir}">
<include name="*.xml"/>
<include name="*.properties"/>
</fileset>
<fortressSentry.jar basedir="${work.jboss.dir}" jarfile="${fortressJbossSentryDistro.jar}"/>
</target>
<target name="build"
depends="clean,build-jar-tcproxy,build-jar-tc7proxy,build-jar-impl, build-jar-distro,build-jar-distro-jboss,javadoc">
<copy todir="${dist.dir}" file="${basedir}/LICENSE.txt"/>
<copy todir="${dist.dir}" file="${basedir}/NOTICE.txt"/>
<copy todir="${dist.dir}" file="${basedir}/TOMCAT-SETUP-NOTES.txt"/>
</target>
<!-- ############### create distribution packages ############################ -->
<target name="dist" depends="build" description="Create source and binary distribution">
<zip destfile='${src.dist.zip}'>
<zipfileset dir='${src.java.dir}'/>
<zipfileset dir='${dist.dir}' prefix='META-INF'>
<include name="*.txt"/>
</zipfileset>
</zip>
<zip destfile="${javadoc.dist.zip}" basedir="${javadoc.dir}">
<zipfileset dir='${dist.dir}' prefix='META-INF'>
<include name="LICENSE.txt"/>
<include name="NOTICE.txt"/>
</zipfileset>
</zip>
<echo message="############### Modify fortress configuration per user settings ###############"/>
<delete file="${dst.remote.conf}"/>
<copyfile src="${src.remote.conf}" dest="${dst.remote.conf}"/>
<replace file="${dst.remote.conf}" token="@SUFFIX@" value="${suffix}"/>
<replace file="${dst.remote.conf}" token="@LDAP_HOST@" value="${ldap.host}"/>
<replace file="${dst.remote.conf}" token="@LDAP_PORT@" value="${ldap.port}"/>
<replace file="${dst.remote.conf}" token="@ROOT_DN@" value="${root.dn}"/>
<replace file="${dst.remote.conf}" token="@CFG_ROOT_PW@" value="${cfg.root.pw}"/>
<replace file="${dst.remote.conf}" token="@ADM_MIN_CONN@" value="${admin.min.conn}"/>
<replace file="${dst.remote.conf}" token="@ADM_MAX_CONN@" value="${admin.max.conn}"/>
<replace file="${dst.remote.conf}" token="@CFG_CRYPTO_PROP@" value="${crypto.prop}"/>
<replace file="${dst.remote.conf}" token="@ENABLE_LDAP_SSL@" value="${enable.ldap.ssl}"/>
<replace file="${dst.remote.conf}" token="@ENABLE_LDAP_SSL_DEBUG@" value="${enable.ldap.ssl.debug}"/>
<replace file="${dst.remote.conf}" token="@TRUST_STORE@" value="${trust.store}"/>
<replace file="${dst.remote.conf}" token="@TRUST_STORE_PW@" value="${trust.store.password}"/>
<replace file="${dst.remote.conf}" token="@TRUST_STORE_SET_PROPW@" value="${trust.store.set.prop}"/>
<!-- Break up the install binary packages by platform: -->
<zip destfile="${fortressSentry.zip}">
<zipfileset dir="${dist.dir}" prefix="doc">
<include name="fortressSentryDoc*.zip"/>
</zipfileset>
<zipfileset dir="${dist.dir}" prefix="src">
<include name="fortressSentrySrc*.zip"/>
</zipfileset>
<zipfileset dir="${dist.dir}" prefix="proxy">
<include name="fortressTomcatSentry*.jar"/>
<include name="fortressTomcat7Sentry*.jar"/>
</zipfileset>
<zipfileset dir="${lib.dir}" prefix="lib" excludes="ws_runtime*,*catalina*,websphere*">
<include name="*.jar"/>
</zipfileset>
<zipfileset dir="${dist.dir}" prefix="lib">
<include name="fortress*.jar"/>
<exclude name="fortressTomcatSentry*.jar"/>
<exclude name="fortressTomcat7Sentry*.jar"/>
</zipfileset>
<zipfileset dir="${config.dir}" prefix="conf">
<include name="*.xml"/>
<include name="*.properties"/>
</zipfileset>
<zipfileset dir='${basedir}'>
<include name="*.txt"/>
<exclude name="WEBSPHERE*"/>
</zipfileset>
</zip>
<antcall target="builder"></antcall>
</target>
<!-- =================================
create Fortress Sentry Builder distribution package
================================= -->
<target name="builder" depends="init" description="--> create the Sentry Builder distribution package">
<echo message="############### Create Sentry package named: ${fortressSentryBuilder.zip} ###############"/>
<zip destfile="${fortressSentryBuilder.zip}"
update="true">
<zipfileset dir="${src.dir}" prefix="sentry-${version}/src">
<include name="*/**"/>
<exclude name="*.iml"/>
</zipfileset>
<zipfileset dir="${basedir}" prefix="sentry-${version}">
<include name="*.xml"/>
<include name="*.txt"/>
<include name="*.properties"/>
<include name="*.sh"/>
<include name="*.bat"/>
<include name="*.html"/>
<exclude name="*.log"/>
<exclude name="build.sh"/>
<exclude name="READ-ME.txt"/>
</zipfileset>
<zipfileset dir="${config.dir}" prefix="sentry-${version}/conf">
<include name="*/**"/>
</zipfileset>
</zip>
</target>
<!-- =================================
Deploy Sentry to Tomcat server
================================= -->
<target name="deploy-tomcat" depends="build" description="Deploy the security realm to Tomcat">
<antcall target="deploy-tomcat-nix"></antcall>
<antcall target="deploy-tomcat-win"></antcall>
</target>
<!-- =================================
Initialize Tomcat SSL Configuration
================================= -->
<target name="init-tomcat-ssl" depends="init">
<antcall target="enable-tomcat-ssl"></antcall>
<antcall target="disable-tomcat-ssl"></antcall>
</target>
<!-- =================================
Enable Tomcat SSL
================================= -->
<target name="enable-tomcat-ssl" depends="init" if="key.store">
<echo message="############### Enable Tomcat SSL"/>
<replace file="${dst.server.xml}" token="@FORTRESS-SSL-CONFIG@" value="${tomcat-ssl.conf}"/>
</target>
<!-- =================================
Disable Tomcat SSL
================================= -->
<target name="disable-tomcat-ssl" depends="init" unless="key.store">
<echo message="############### Disable Tomcat SSL"/>
<replace file="${dst.server.xml}" token="@FORTRESS-SSL-CONFIG@" value=""/>
</target>
<!-- =================================
Deploy Sentry to Tomcat server to Unix
================================= -->
<target name="deploy-tomcat-nix" depends="build" description="Deploy the security realm to Tomcat on Unix"
unless="windows">
<property name="src.catalina.sh" value="${tomcat.dir}/bin/catalina.sh.src"/>
<property name="dst.catalina.sh" value="${tomcat.dir}/bin/catalina.sh"/>
<property name="src.server.xml" value="${tomcat.dir}/conf/server.xml.src"/>
<property name="dst.server.xml" value="${tomcat.dir}/conf/server.xml"/>
<echo message="############### Deploy the Tomcat Security Realm to Unix ###############"/>
<delete file="${dst.catalina.sh}"/>
<copyfile src="${src.catalina.sh}" dest="${dst.catalina.sh}"/>
<replace file="${dst.catalina.sh}" token="@JAVA_HOME@" value="${java.home}"/>
<delete file="${dst.server.xml}"/>
<copyfile src="${src.server.xml}" dest="${dst.server.xml}"/>
<replace file="${dst.server.xml}" token="@FORTRESS-SENTRY-REALM@" value="${tomcat-realm.conf}"/>
<antcall target="init-tomcat-ssl"></antcall>
<copyfile src="${fortressTomcat7Sentry.jar}" dest="${dst.server.xml}"/>
<copy todir="${tomcat.dir}/lib" file="${fortressTomcat7Sentry.jar}"/>
</target>
<!-- =================================
Deploy Sentry to Tomcat server to Windows
================================= -->
<target name="deploy-tomcat-win" depends="build" description="Deploy the security realm to Tomcat on Windows"
if="windows">
<property name="src.catalina.bat" value="${tomcat.dir}\bin\catalina.bat.src"/>
<property name="dst.catalina.bat" value="${tomcat.dir}\bin\catalina.bat"/>
<property name="src.server.xml" value="${tomcat.dir}\conf\server.xml.src"/>
<property name="dst.server.xml" value="${tomcat.dir}\conf\server.xml"/>
<echo message="############### Deploy the Tomcat Security Realm to Windows ###############"/>
<delete file="${dst.catalina.bat}"/>
<copyfile src="${src.catalina.bat}" dest="${dst.catalina.bat}"/>
<replace file="${dst.catalina.bat}" token="@JAVA_HOME@" value="${java.home}"/>
<delete file="${dst.server.xml}"/>
<copyfile src="${src.server.xml}" dest="${dst.server.xml}"/>
<replace file="${dst.server.xml}" token="@FORTRESS-SENTRY-REALM@" value="${tomcat-realm.conf}"/>
<copyfile src="${fortressTomcat7Sentry.jar}" dest="${dst.server.xml}"/>
<copy todir="${tomcat.dir}/lib" file="${fortressTomcat7Sentry.jar}"/>
</target>
<!-- =================================
call the target to start the Tomcat server
================================= -->
<target name="start-tomcat" depends="init" description="--> start the Tomcat server">
<antcall target="start-tomcat-nix"></antcall>
<antcall target="start-tomcat-win"></antcall>
</target>
<!-- =================================
Call the Unix Tomcat script to startup
================================= -->
<target name="start-tomcat-nix" depends="init" unless="windows">
<echo message="############### Start the tomcat process on Unix ###############"/>
<property name="startup.sh" value="${tomcat.dir}/bin/startup.sh"/>
<chmod dir="${tomcat.dir}" perm="a+x" includes="**/*.sh"/>
<exec dir="." executable="/bin/sh">
<arg line="${startup.sh}"/>
</exec>
</target>
<!-- =================================
Call the Win Tomcat script to startup
================================= -->
<target name="start-tomcat-win" depends="init" if="windows">
<echo message="############### Start the tomcat process on win ###############"/>
<property name="dst.start.tomcat-script-win" value="${user.dir}/${tomcat.dir}/bin/startup.bat"/>
<exec command="cmd.exe" spawn="false" osfamily="windows" dir="${user.dir}/${tomcat.dir}/bin">
<arg value="/${fortress.home.drive}"/>
<arg value="${dst.start.tomcat-script-win}"/>
</exec>
</target>
<!-- =================================
call the target to stop the Tomcat server
================================= -->
<target name="stop-tomcat" depends="init" description="--> stop the Tomcat server">
<antcall target="stop-tomcat-win"></antcall>
<antcall target="stop-tomcat-nix"></antcall>
</target>
<!-- =================================
Call the unix Tomcat script to shutdown
================================= -->
<target name="stop-tomcat-nix" depends="init" unless="windows">
<echo message="############### Stop the tomcat process on nix ###############"/>
<property name="shutdown.sh" value="${tomcat.dir}/bin/shutdown.sh"/>
<exec dir="." executable="/bin/sh">
<arg line="${shutdown.sh}"/>
</exec>
</target>
<!-- =================================
Call the Win Tomcat script to shutdown
================================= -->
<target name="stop-tomcat-win" depends="init" if="windows">
<echo message="############### Stop the tomcat process on win ###############"/>
<property name="shutdown.bat" value="${user.dir}/${tomcat.dir}/bin/shutdown.bat"/>
<exec command="cmd.exe" spawn="false" osfamily="windows" dir="${user.dir}/${tomcat.dir}/bin">
<arg value="/${fortress.home.drive}"/>
<arg value="${shutdown.bat}"/>
</exec>
</target>
<!-- =================================
Deploy snapshot to remote Maven repository
================================= -->
<target name="deploy" depends="dist" description="deploy snapshot version to Maven snapshot repository">
<artifact:mvn>
<arg value="org.apache.maven.plugins:maven-deploy-plugin:2.6:deploy-file"/>
<arg value="-Durl=${maven-snapshots-repository-url}"/>
<arg value="-DrepositoryId=${maven-snapshots-repository-id}"/>
<arg value="-DpomFile=pom.xml"/>
<arg value="-Dfile=${maven-jar}"/>
</artifact:mvn>
</target>
<!-- =================================
Update project version (both build.xml and pom.xml) from SNAPSHOT to RELEASE
================================= -->
<target name="stage" depends="dist" description="deploy release version to Maven staging repository">
<!-- sign and deploy the impl jar -->
<artifact:mvn>
<arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file"/>
<arg value="-Durl=${maven-staging-repository-url}"/>
<arg value="-DrepositoryId=${maven-staging-repository-id}"/>
<arg value="-DpomFile=pom.xml"/>
<arg value="-Dfile=${realm-impl.jar}"/>
<arg value="-Pgpg"/>
</artifact:mvn>
<!-- sign and deploy the impl jar -->
<artifact:mvn>
<arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file"/>
<arg value="-Durl=${maven-staging-repository-url}"/>
<arg value="-DrepositoryId=${maven-staging-repository-id}"/>
<arg value="-DpomFile=pom.xml"/>
<arg value="-Dfile=${realm-proxy.jar}"/>
<arg value="-Dclassifier=proxy"/>
<arg value="-Pgpg"/>
</artifact:mvn>
<!-- sign and deploy the main artifact -->
<artifact:mvn>
<arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file"/>
<arg value="-Durl=${maven-staging-repository-url}"/>
<arg value="-DrepositoryId=${maven-staging-repository-id}"/>
<arg value="-DpomFile=pom.xml"/>
<arg value="-Dfile=${maven-jar}"/>
<arg value="-Dclassifier=dist"/>
<arg value="-Pgpg"/>
</artifact:mvn>
<!-- sign and deploy the sources artifact -->
<artifact:mvn>
<arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file"/>
<arg value="-Durl=${maven-staging-repository-url}"/>
<arg value="-DrepositoryId=${maven-staging-repository-id}"/>
<arg value="-DpomFile=pom.xml"/>
<arg value="-Dfile=${maven-sources-jar}"/>
<arg value="-Dclassifier=sources"/>
<arg value="-Pgpg"/>
</artifact:mvn>
<!-- sign and deploy the javadoc artifact -->
<artifact:mvn>
<arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file"/>
<arg value="-Durl=${maven-staging-repository-url}"/>
<arg value="-DrepositoryId=${maven-staging-repository-id}"/>
<arg value="-DpomFile=pom.xml"/>
<arg value="-Dfile=${maven-javadoc-jar}"/>
<arg value="-Dclassifier=javadoc"/>
<arg value="-Pgpg"/>
</artifact:mvn>
</target>
</project>