Recovery of changes made before the big plugin overhaul
plugin.jelly o extraneous markup removed o improved logging o improved filters for goals that copy o added ability for each webserver to have a clean target plugin.properties o adding maven.webserver.root which says where to serve documents from apache-2.x.jelly o add goals that start apache for Windows NT/XP/2000 o add a clean goal to cleanup installed services git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@112737 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
c96a400841
commit
31f11f1b4a
@ -8,7 +8,7 @@
|
||||
<!--==================================================================-->
|
||||
<!-- S U P P O R T E D W E B S E R V E R S -->
|
||||
<!--==================================================================-->
|
||||
<j:import inherit="true" uri="file:${plugin.resources}/apache-2.x.jelly" />
|
||||
<j:import inherit="true" uri="apache-2.x.jelly" />
|
||||
|
||||
<!--==================================================================-->
|
||||
<!-- B E G I N C O R E P R O C E S S I N G -->
|
||||
@ -17,15 +17,28 @@
|
||||
<goal name="webserver:init"
|
||||
description="Initialize resources needed for the plugin">
|
||||
|
||||
<!-- a flag to see if the webserver is started -->
|
||||
<ant:condition property="maven.webserver.started">
|
||||
<ant:http url="${maven.webserver.url}" />
|
||||
</ant:condition>
|
||||
|
||||
<!-- a flag to see if the webserver is installed -->
|
||||
<ant:available property="maven.webserver.installed"
|
||||
file="${maven.webserver.dir}" type="dir" />
|
||||
file="${maven.webserver.root}" type="dir" />
|
||||
|
||||
<!-- convert all path related properties to their os equivalent -->
|
||||
<ant:property name="maven.webserver.home.path"
|
||||
location="${maven.webserver.home}" />
|
||||
<ant:property name="maven.webserver.conf.dir.path"
|
||||
location="${maven.webserver.conf.dir}" />
|
||||
<ant:property name="maven.webserver.root.path"
|
||||
location="${maven.webserver.root}" />
|
||||
<ant:property name="maven.webserver.dir.path"
|
||||
location="${maven.webserver.dir}" />
|
||||
|
||||
<!-- create the filterset to be available to copy tasks that want it -->
|
||||
<ant:filterset id="maven.webserver.filterset.default">
|
||||
<ant:filter token="maven.webserver.home" value="${maven.webserver.home}" />
|
||||
<ant:filter token="maven.webserver.home" value="${maven.webserver.home.path}" />
|
||||
<ant:filter token="maven.webserver.name" value="${maven.webserver.name}" />
|
||||
<ant:filter token="maven.webserver.version" value="${maven.webserver.version}" />
|
||||
<ant:filter token="maven.webserver.port.http" value="${maven.webserver.port.http}" />
|
||||
@ -33,10 +46,10 @@
|
||||
<ant:filter token="maven.webserver.port.one" value="${maven.webserver.port.one}" />
|
||||
<ant:filter token="maven.webserver.port.two" value="${maven.webserver.port.two}" />
|
||||
<ant:filter token="maven.webserver.port.three" value="${maven.webserver.port.three}" />
|
||||
<ant:filter token="maven.webserver.conf.dir" value="${maven.webserver.conf.dir}" />
|
||||
<ant:filter token="maven.webserver.conf.dir" value="${maven.webserver.conf.dir.path}" />
|
||||
<ant:filter token="maven.webserver.host" value="${maven.webserver.host}" />
|
||||
<!-- FIXME - should be moved to a webapp plugin -->
|
||||
<ant:filter token="maven.webapp.dir" value="${maven.webapp.dir}" />
|
||||
<ant:filter token="maven.webserver.dir" value="${maven.webserver.dir.path}" />
|
||||
<ant:filter token="maven.webserver.root" value="${maven.webserver.root.path}" />
|
||||
</ant:filterset>
|
||||
|
||||
<ant:filterset id="maven.webserver.filterset">
|
||||
@ -57,8 +70,7 @@
|
||||
</j:choose>
|
||||
</j:set>
|
||||
|
||||
<log:info trim="false">
|
||||
Maven has determined your <j:expr value="${maven.webserver.fullname}"/> webserver instance is <j:expr value="${maven.webserver.installed.msg}"/> in directory [ <j:expr value="${maven.webserver.dir}"/> ] and <j:expr value="${maven.webserver.started.msg}"/> on <j:expr value="${maven.webserver.url}"/>
|
||||
<log:info trim="false">Maven has determined your <j:expr value="${maven.webserver.fullname}"/> webserver instance is <j:expr value="${maven.webserver.installed.msg}"/> in directory [ <j:expr value="${maven.webserver.dir}"/> ] and <j:expr value="${maven.webserver.started.msg}"/> on <j:expr value="${maven.webserver.url}"/>
|
||||
</log:info>
|
||||
|
||||
</goal>
|
||||
@ -123,9 +135,10 @@ Maven has determined your <j:expr value="${maven.webserver.fullname}"/> webserve
|
||||
|
||||
<!-- must install before starting -->
|
||||
<j:if test="${!maven.webserver.installed}">
|
||||
<log:info>
|
||||
Installing the <j:expr value="${maven.webserver.fullname}"/>
|
||||
webserver instance before starting it..."/>
|
||||
<log:info trim="false">
|
||||
|
||||
Installing the <j:expr value="${maven.webserver.fullname}" /> webserver instance before starting it ...
|
||||
|
||||
</log:info>
|
||||
<attainGoal name="webserver:install" />
|
||||
</j:if>
|
||||
@ -136,7 +149,7 @@ Maven has determined your <j:expr value="${maven.webserver.fullname}"/> webserve
|
||||
<attainGoal name="webserver:stop" />
|
||||
<log:info>
|
||||
Restarting the <j:expr value="${maven.webserver.fullname}"/>
|
||||
webserver instance ..."/>
|
||||
webserver instance ...
|
||||
</log:info>
|
||||
<attainGoal name="webserver:restart" />
|
||||
</attain>
|
||||
@ -144,7 +157,7 @@ Maven has determined your <j:expr value="${maven.webserver.fullname}"/> webserve
|
||||
<j:when test="${!maven.webserver.installed}">
|
||||
<log:info>
|
||||
Installing the <j:expr value="${maven.webserver.fullname}"/>
|
||||
webserver instance before starting it ..."/>
|
||||
webserver instance before starting it ...
|
||||
</log:info>
|
||||
<attainGoal name="webserver:install" />
|
||||
<attainGoal name="webserver:start-${maven.webserver.fullname}"/>
|
||||
@ -199,7 +212,7 @@ Maven has determined your <j:expr value="${maven.webserver.fullname}"/> webserve
|
||||
<j:if test="${maven.webserver.started}">
|
||||
<log:info>
|
||||
Stopping the <j:expr value="${maven.webserver.fullname}" />
|
||||
webserver instance before deleting it..."/>
|
||||
webserver instance before deleting it...
|
||||
</log:info>
|
||||
<attainGoal name="webserver:stop" />
|
||||
</j:if>
|
||||
@ -207,15 +220,20 @@ Maven has determined your <j:expr value="${maven.webserver.fullname}"/> webserve
|
||||
<j:if test="${maven.webserver.installed}">
|
||||
<log:info>
|
||||
Deleting the <j:expr value="${maven.webserver.fullname}" />
|
||||
webserver instance ..."/>
|
||||
webserver instance ...
|
||||
</log:info>
|
||||
|
||||
<!-- allow webservers to have their own cleanup -->
|
||||
<attainGoal name="webserver:clean-${maven.webserver.fullname}" />
|
||||
<!-- by default cleanup the server dir -->
|
||||
<ant:delete dir="${maven.webserver.dir}"/>
|
||||
|
||||
</j:if>
|
||||
|
||||
<j:if test="${!maven.webserver.installed}">
|
||||
<log:info>
|
||||
The <j:expr value="${maven.webserver.fullname}"/>
|
||||
webserver instance is already cleaned!"/>
|
||||
webserver instance is already cleaned!
|
||||
</log:info>
|
||||
</j:if>
|
||||
|
||||
|
||||
@ -61,7 +61,7 @@ maven.webserver.host=localhost
|
||||
maven.webserver.url=http://${maven.webserver.host}:${maven.webserver.port.http}/index.html
|
||||
|
||||
#
|
||||
# The directory out of which you will server your documents
|
||||
# FIXME: Let's make a webapp plugin and put this property there
|
||||
# The root directory out of which you will server will serve your documents
|
||||
#
|
||||
maven.webapp.dir=${maven.webserver.dir}/webapps/ROOT
|
||||
maven.webserver.root=${maven.webserver.dir}/webapps/ROOT
|
||||
|
||||
|
||||
@ -7,8 +7,7 @@
|
||||
|
||||
<!-- 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" />
|
||||
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
|
||||
@ -17,15 +16,27 @@ 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: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()}" />
|
||||
|
||||
</goal>
|
||||
|
||||
<goal name="webserver:install-apache-2.x"
|
||||
prereqs="webserver:apache-2.x-reqs"
|
||||
description="Install user files into apache installation">
|
||||
<goal name="webserver:install-apache-2.x" prereqs="webserver:apache-2.x-reqs"
|
||||
description="Install Apache 2.x">
|
||||
|
||||
<!-- Create common directories and copy configuration files -->
|
||||
<ant:mkdir dir="${maven.webserver.dir}/logs"/>
|
||||
<ant:mkdir dir="${maven.webserver.dir}/conf"/>
|
||||
<ant:mkdir dir="${maven.webserver.root}"/>
|
||||
|
||||
<!-- copy any user configuration files w/ filtering by forcing copy -->
|
||||
<!-- expecting at least a httpd.conf -->
|
||||
@ -35,26 +46,185 @@ ${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>
|
||||
|
||||
<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>
|
||||
|
||||
<!-- 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> -->
|
||||
|
||||
</goal>
|
||||
|
||||
<goal name="webserver:start-apache-2.x"
|
||||
description="Start Apache">
|
||||
<log:warn>
|
||||
Not implemented yet!
|
||||
</log:warn>
|
||||
<goal name="webserver:start-apache-2.x" description="Start 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 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>
|
||||
|
||||
</goal>
|
||||
|
||||
<goal name="webserver:restart-apache-2.x"
|
||||
description="Restart Apache">
|
||||
<log:warn>
|
||||
Not implemented yet!
|
||||
</log:warn>
|
||||
<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>
|
||||
|
||||
<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>
|
||||
|
||||
</goal>
|
||||
|
||||
<goal name="webserver:stop-apache-2.x" description="Stop Apache">
|
||||
<log:warn>
|
||||
Not implemented yet!
|
||||
</log:warn>
|
||||
<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>
|
||||
|
||||
<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>
|
||||
|
||||
</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>
|
||||
|
||||
<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>
|
||||
|
||||
</goal>
|
||||
|
||||
</project>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user