git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@114795 13f79535-47bb-0310-9956-ffa450edef68
264 lines
10 KiB
XML
264 lines
10 KiB
XML
<?xml version="1.0"?>
|
|
<!--
|
|
/*
|
|
* Copyright 2001-2004 The Apache Software Foundation.
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
-->
|
|
|
|
|
|
<project xmlns:j="jelly:core" xmlns:log="jelly:log" xmlns:ant="jelly:ant"
|
|
xmlns:apache2x="http://www.maven.org/plugin/webserver/apache2x"
|
|
xmlns:define="jelly:define" >
|
|
|
|
<goal name="webserver:apache-2.x-reqs"
|
|
description="Intialize resources for apache processing">
|
|
|
|
<!-- Check if user has http.conf in a conf dir -->
|
|
<ant:available file="${maven.webserver.conf.dir}/conf/httpd.conf"
|
|
type="file" property="maven.webserver.apache2x.has.conf" value="true" />
|
|
|
|
<ant:fail unless="maven.webserver.apache2x.has.conf">
|
|
To use this webserver, you must have a project specific
|
|
configuration file at the following location:
|
|
|
|
${maven.webserver.conf.dir}/conf/httpd.conf
|
|
</ant:fail>
|
|
|
|
<ant:property name="maven.webserver.apache.executable"
|
|
location="${maven.webserver.home}/bin/apache" />
|
|
|
|
<ant:property name="maven.webserver.apache.httpd.conf"
|
|
location="${maven.webserver.dir}/conf/httpd.conf" />
|
|
|
|
<j:if test="${systemScope['os.name'].startsWith('Windows')}">
|
|
<j:set var="maven.webserver.apache2x.service.name"
|
|
value="${context.getVariable('user.name')}-maven-webserver-${pom.getId()}" />
|
|
</j:if>
|
|
|
|
<define:taglib uri="http://www.maven.org/plugin/webserver/apache2x">
|
|
|
|
<!-- accept the force property with a value of true or false -->
|
|
<define:tag name="install">
|
|
|
|
<j:if test="${force == 'false'}">
|
|
<!-- Create common directories and copy configuration files -->
|
|
<ant:mkdir dir="${maven.webserver.dir}/logs"/>
|
|
<ant:mkdir dir="${maven.webserver.dir}/conf"/>
|
|
</j:if>
|
|
|
|
<!-- copy any user configuration files w/ filtering by forcing copy -->
|
|
<!-- if reinstall -->
|
|
<ant:copy todir="${maven.webserver.dir}" overwrite="${force}">
|
|
<ant:fileset dir="${maven.webserver.conf.dir}" />
|
|
<ant:filterset refid="maven.webserver.filterset.default" />
|
|
</ant:copy>
|
|
|
|
<j:if test="${systemScope['os.name'].startsWith('Windows') and force == 'false'}">
|
|
|
|
<!-- try to install the service for this project on Windows NT/2000/XP -->
|
|
<!-- Windows 98/ME don't use a service -->
|
|
<ant:exec executable="${maven.webserver.home}\bin\apache.exe"
|
|
os="Windows NT,Windows 2000,Windows XP">
|
|
<ant:arg value="-d" />
|
|
<ant:arg line="${maven.webserver.root}" />
|
|
<ant:arg value="-f" />
|
|
<ant:arg line="${maven.webserver.dir}\conf\httpd.conf" />
|
|
<ant:arg line="-k install" />
|
|
<ant:arg line="-n ${maven.webserver.apache2x.service.name}" />
|
|
</ant:exec>
|
|
|
|
</j:if>
|
|
|
|
<!-- TBD - should I install a helper script for each install??? -->
|
|
<!-- <ant:copy file="${plugin.dir}/apache-2.x.bat"
|
|
tofile="${maven.webserver.dir}/apache.bat" overwrite="true">
|
|
<ant:filterset refid="maven.webserver.filterset.default" />
|
|
<ant:filterset refid="maven.webserver.filterset" />
|
|
</ant:copy> -->
|
|
</define:tag>
|
|
</define:taglib>
|
|
|
|
</goal>
|
|
|
|
<!--==================================================================-->
|
|
<!-- R E I N S T A L L -->
|
|
<!--==================================================================-->
|
|
<goal name="webserver:reinstall-apache-2.x"
|
|
prereqs="webserver:apache-2.x-reqs" description="Reinstall Apache 2.x">
|
|
<apache2x:install force="true"/>
|
|
</goal>
|
|
|
|
<!--==================================================================-->
|
|
<!-- I N S T A L L -->
|
|
<!--==================================================================-->
|
|
<goal name="webserver:install-apache-2.x" prereqs="webserver:apache-2.x-reqs"
|
|
description="Install Apache 2.x">
|
|
<apache2x:install force="false"/>
|
|
</goal>
|
|
|
|
<!--==================================================================-->
|
|
<!-- S T A R T -->
|
|
<!--==================================================================-->
|
|
<goal name="webserver:start-apache-2.x" prereqs="webserver:apache-2.x-reqs"
|
|
description="Start Apache 2.x" >
|
|
|
|
<j:choose>
|
|
<j:when test="${systemScope['os.name'].startsWith('Windows')}">
|
|
|
|
<ant:exec executable="${maven.webserver.home}\bin\apache.exe"
|
|
os="Windows NT,Windows 2000,Windows XP"
|
|
resultProperty="maven.webserver.service_installed">
|
|
<ant:arg value="-d" />
|
|
<ant:arg line="${maven.webserver.root}" />
|
|
<ant:arg value="-f" />
|
|
<ant:arg line="${maven.webserver.dir}\conf\httpd.conf" />
|
|
<ant:arg line="-k start" />
|
|
<ant:arg line="-n ${maven.webserver.apache2x.service.name}" />
|
|
</ant:exec>
|
|
|
|
<j:if test="${context.getVariable('maven.webserver.service_installed') == 2}" >
|
|
|
|
<log:info trim="false">
|
|
Missing service detected. Trying to install a new webserver instance service...
|
|
</log:info>
|
|
|
|
<ant:exec executable="${maven.webserver.home}\bin\apache.exe"
|
|
os="Windows 2000,Windows NT,Windows XP" failonerror="true">
|
|
<ant:arg value="-d" />
|
|
<ant:arg line="${maven.webserver.root}" />
|
|
<ant:arg value="-f" />
|
|
<ant:arg line="${maven.webserver.dir}\conf\httpd.conf" />
|
|
<ant:arg line="-k install" />
|
|
<ant:arg line="-n ${maven.webserver.apache2x.service.name}" />
|
|
</ant:exec>
|
|
|
|
<ant:exec executable="${maven.webserver.home}\bin\apache.exe"
|
|
os="Windows 2000,Windows NT,Windows XP" failonerror="true">
|
|
<ant:arg value="-d" />
|
|
<ant:arg line="${maven.webserver.root}" />
|
|
<ant:arg value="-f" />
|
|
<ant:arg line="${maven.webserver.dir}\conf\httpd.conf" />
|
|
<ant:arg line="-k start" />
|
|
<ant:arg line="-n ${maven.webserver.apache2x.service.name}" />
|
|
</ant:exec>
|
|
|
|
</j:if>
|
|
|
|
</j:when>
|
|
<j:otherwise>
|
|
|
|
<!-- nix nay on the winay assumes default apache install -->
|
|
<ant:exec executable="${maven.webserver.home}/bin/apachectl">
|
|
<ant:arg value="-d" />
|
|
<ant:arg line="${maven.webserver.root}" />
|
|
<ant:arg value="-f" />
|
|
<ant:arg line="${maven.webserver.dir}/conf/httpd.conf" />
|
|
<ant:arg line="-k start" />
|
|
</ant:exec>
|
|
|
|
</j:otherwise>
|
|
</j:choose>
|
|
</goal>
|
|
|
|
<!--==================================================================-->
|
|
<!-- R E S T A R T -->
|
|
<!--==================================================================-->
|
|
<goal name="webserver:restart-apache-2.x" description="Restart Apache 2.x"
|
|
prereqs="webserver:apache-2.x-reqs" >
|
|
|
|
<j:choose>
|
|
<j:when test="${systemScope['os.name'].startsWith('Windows')}">
|
|
|
|
<ant:exec executable="${maven.webserver.home}\bin\apache.exe"
|
|
os="Windows NT,Windows 2000,Windows XP">
|
|
<ant:arg value="-d" />
|
|
<ant:arg line="${maven.webserver.root}" />
|
|
<ant:arg value="-f" />
|
|
<ant:arg line="${maven.webserver.dir}\conf\httpd.conf" />
|
|
<ant:arg line="-k restart" />
|
|
<ant:arg line="-n ${maven.webserver.apache2x.service.name}" />
|
|
</ant:exec>
|
|
|
|
</j:when>
|
|
<j:otherwise>
|
|
<ant:exec executable="${maven.webserver.home}/bin/apachectl">
|
|
<ant:arg value="-d" />
|
|
<ant:arg line="${maven.webserver.root}" />
|
|
<ant:arg value="-f" />
|
|
<ant:arg line="${maven.webserver.dir}/conf/httpd.conf" />
|
|
<ant:arg line="-k restart" />
|
|
</ant:exec>
|
|
</j:otherwise>
|
|
</j:choose>
|
|
</goal>
|
|
|
|
<!--==================================================================-->
|
|
<!-- S T O P -->
|
|
<!--==================================================================-->
|
|
<goal name="webserver:stop-apache-2.x" description="Stop Apache 2.x"
|
|
prereqs="webserver:apache-2.x-reqs" >
|
|
|
|
<j:choose>
|
|
<j:when test="${systemScope['os.name'].startsWith('Windows')}">
|
|
|
|
<ant:exec executable="${maven.webserver.home}\bin\apache.exe"
|
|
os="Windows NT,Windows 2000,Windows XP">
|
|
<ant:arg value="-d" />
|
|
<ant:arg line="${maven.webserver.root}" />
|
|
<ant:arg value="-f" />
|
|
<ant:arg line="${maven.webserver.dir}\conf\httpd.conf" />
|
|
<ant:arg line="-k stop" />
|
|
<ant:arg line="-n ${maven.webserver.apache2x.service.name}" />
|
|
</ant:exec>
|
|
|
|
</j:when>
|
|
<j:otherwise>
|
|
|
|
<ant:exec executable="${maven.webserver.home}/bin/apachectl">
|
|
<ant:arg value="-d" />
|
|
<ant:arg line="${maven.webserver.root}" />
|
|
<ant:arg value="-f" />
|
|
<ant:arg line="${maven.webserver.dir}/conf/httpd.conf" />
|
|
<ant:arg line="-k stop" />
|
|
</ant:exec>
|
|
|
|
</j:otherwise>
|
|
</j:choose>
|
|
</goal>
|
|
|
|
<!--==================================================================-->
|
|
<!-- C L E A N -->
|
|
<!--==================================================================-->
|
|
<goal name="webserver:clean-apache-2.x" description="Clean Apache 2.x"
|
|
prereqs="webserver:apache-2.x-reqs" >
|
|
|
|
<!-- to clean up on windows uninstall the service -->
|
|
<j:if test="${systemScope['os.name'].startsWith('Windows')}">
|
|
|
|
<ant:exec executable="${maven.webserver.home}\bin\apache.exe"
|
|
os="Windows NT,Windows 2000,Windows XP">
|
|
<ant:arg value="-d" />
|
|
<ant:arg line="${maven.webserver.root}" />
|
|
<ant:arg value="-f" />
|
|
<ant:arg line="${maven.webserver.dir}\conf\httpd.conf" />
|
|
<ant:arg line="-k uninstall" />
|
|
<ant:arg line="-n ${maven.webserver.apache2x.service.name}" />
|
|
</ant:exec>
|
|
|
|
</j:if>
|
|
</goal>
|
|
|
|
</project>
|