You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by pl...@apache.org on 2003/01/25 11:04:04 UTC

cvs commit: jakarta-turbine-maven/src/plugins-build/webserver/src/plugin-resources apache-2.x.jelly

plynch      2003/01/25 02:04:04

  Modified:    src/plugins-build/webserver plugin.jelly plugin.properties
               src/plugins-build/webserver/src/plugin-resources
                        apache-2.x.jelly
  Log:
  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
  
  Revision  Changes    Path
  1.2       +38 -20    jakarta-turbine-maven/src/plugins-build/webserver/plugin.jelly
  
  Index: plugin.jelly
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-maven/src/plugins-build/webserver/plugin.jelly,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- plugin.jelly	24 Jan 2003 03:46:24 -0000	1.1
  +++ plugin.jelly	25 Jan 2003 10:04:03 -0000	1.2
  @@ -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 @@
   
       <!-- 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 @@
             <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 @@
         <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}"/>
  @@ -161,7 +174,7 @@
     <goal name="webserver:restart"
       prereqs="webserver:init,webserver:restart-${maven.webserver.fullname}"
       description="Restart the web server instance">
  -    <!-- <attainGoal name="start-${maven.webserver.fullname}" />-->
  +    <!-- <attainGoal name="start-${maven.webserver.fullname}" /> -->
     </goal>
   
     <!--==================================================================-->
  @@ -198,27 +211,32 @@
   
       <j:if test="${maven.webserver.started}">
         <log:info>
  -        Stopping the <j:expr value="${maven.webserver.fullname}"/>
  -        webserver instance before deleting it..."/>
  +        Stopping the <j:expr value="${maven.webserver.fullname}" />
  +        webserver instance before deleting it...
         </log:info>
         <attainGoal name="webserver:stop" />
       </j:if>
   
       <j:if test="${maven.webserver.installed}">
         <log:info>
  -        Deleting the <j:expr value="${maven.webserver.fullname}"/>
  -        webserver instance ..."/>
  +        Deleting the <j:expr value="${maven.webserver.fullname}" />
  +        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>
   
     </goal>
   
  -</project>
  +</project>
  \ No newline at end of file
  
  
  
  1.2       +3 -3      jakarta-turbine-maven/src/plugins-build/webserver/plugin.properties
  
  Index: plugin.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-maven/src/plugins-build/webserver/plugin.properties,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- plugin.properties	24 Jan 2003 03:46:25 -0000	1.1
  +++ plugin.properties	25 Jan 2003 10:04:04 -0000	1.2
  @@ -61,7 +61,7 @@
   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
  +
  
  
  
  1.2       +190 -20   jakarta-turbine-maven/src/plugins-build/webserver/src/plugin-resources/apache-2.x.jelly
  
  Index: apache-2.x.jelly
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-maven/src/plugins-build/webserver/src/plugin-resources/apache-2.x.jelly,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- apache-2.x.jelly	24 Jan 2003 03:46:25 -0000	1.1
  +++ apache-2.x.jelly	25 Jan 2003 10:04:04 -0000	1.2
  @@ -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 @@
   ${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 @@
         <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 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:stop-apache-2.x" description="Stop Apache">
  -    <log:warn>
  -      Not implemented yet!
  -    </log:warn>
  +  <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>
  +</project>