o adding support for a unix installed apache2.x server. The executable is assumed to be in /bin as that is the apache classic layout. May need an RFE to specify the path to the exec. depending how wacky people are with their installs.

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@112780 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
plynch 2003-01-30 12:11:04 +00:00
parent ed59934793
commit 5d9065724d

View File

@ -22,11 +22,10 @@ ${maven.webserver.conf.dir}/conf/httpd.conf
<ant:property name="maven.webserver.apache.httpd.conf"
location="${maven.webserver.dir}/conf/httpd.conf" />
<j:set var="osName" value="${context.getVariable('os.name')}" />
<!-- TODO - only run this for Windows NT/2000/XP -->
<j:set var="maven.webserver.apache2x.service.name"
value="${context.getVariable('user.name')}-maven-webserver-${pom.getId()}" />
<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>
</goal>
@ -46,36 +45,41 @@ ${maven.webserver.conf.dir}/conf/httpd.conf
<ant:filterset refid="maven.webserver.filterset" />
</ant:copy>
<!-- try to install the service for this project on Windows NT/2000/XP -->
<ant:exec executable="${maven.webserver.home}\bin\apache.exe"
os="Windows 2000">
<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 test="${systemScope['os.name'].startsWith('Windows')}">
<ant:exec executable="${maven.webserver.home}\bin\apache.exe"
os="Windows NT">
<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>
<!-- 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 2000">
<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 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>
<ant:exec executable="${maven.webserver.home}\bin\apache.exe"
os="Windows NT">
<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 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"
@ -88,143 +92,189 @@ ${maven.webserver.conf.dir}/conf/httpd.conf
<goal name="webserver:start-apache-2.x" description="Start 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 2000">
<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>
<ant:exec executable="${maven.webserver.home}\bin\apache.exe"
os="Windows 2000">
<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>
<ant:exec executable="${maven.webserver.home}\bin\apache.exe"
os="Windows NT">
<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>
<ant:exec executable="${maven.webserver.home}\bin\apache.exe"
os="Windows NT">
<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>
<ant:exec executable="${maven.webserver.home}\bin\apache.exe"
os="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 start" />
<ant:arg line="-n ${maven.webserver.apache2x.service.name}" />
</ant:exec>
<ant:exec executable="${maven.webserver.home}\bin\apache.exe"
os="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 start" />
<ant:arg line="-n ${maven.webserver.apache2x.service.name}" />
</ant:exec>
</j:when>
<j:otherwise>
<!-- nix nay on the wi nay 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>
<goal name="webserver:restart-apache-2.x" description="Restart Apache 2.x"
prereqs="webserver:apache-2.x-reqs" >
<ant:exec executable="${maven.webserver.home}\bin\apache.exe"
os="Windows 2000">
<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:choose>
<j:when test="${systemScope['os.name'].startsWith('Windows')}">
<ant:exec executable="${maven.webserver.home}\bin\apache.exe"
os="Windows 2000">
<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>
<ant:exec executable="${maven.webserver.home}\bin\apache.exe"
os="Windows NT">
<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>
<ant:exec executable="${maven.webserver.home}\bin\apache.exe"
os="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>
<ant:exec executable="${maven.webserver.home}\bin\apache.exe"
os="Windows NT">
<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>
<ant:exec executable="${maven.webserver.home}\bin\apache.exe"
os="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>
<goal name="webserver:stop-apache-2.x" description="Stop Apache 2.x"
prereqs="webserver:apache-2.x-reqs" >
<ant:exec executable="${maven.webserver.home}\bin\apache.exe"
os="Windows 2000">
<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:choose>
<j:when test="${systemScope['os.name'].startsWith('Windows')}">
<ant:exec executable="${maven.webserver.home}\bin\apache.exe"
os="Windows 2000">
<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>
<ant:exec executable="${maven.webserver.home}\bin\apache.exe"
os="Windows NT">
<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>
<ant:exec executable="${maven.webserver.home}\bin\apache.exe"
os="Windows NT">
<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>
<ant:exec executable="${maven.webserver.home}\bin\apache.exe"
os="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>
<ant:exec executable="${maven.webserver.home}\bin\apache.exe"
os="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>
<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 -->
<ant:exec executable="${maven.webserver.home}\bin\apache.exe"
os="Windows 2000">
<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 test="${systemScope['os.name'].startsWith('Windows')}">
<ant:exec executable="${maven.webserver.home}\bin\apache.exe"
os="Windows NT">
<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>
<ant:exec executable="${maven.webserver.home}\bin\apache.exe"
os="Windows 2000">
<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>
<ant:exec executable="${maven.webserver.home}\bin\apache.exe"
os="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>
<ant:exec executable="${maven.webserver.home}\bin\apache.exe"
os="Windows NT">
<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>
<ant:exec executable="${maven.webserver.home}\bin\apache.exe"
os="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>