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/23 21:28:07 UTC

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

plynch      2003/01/23 12:28:07

  Modified:    src/plugins-build/webserver apache-2.x.jelly
  Log:
  o add goals that start apache for Windows NT/XP/2000
  o add a clean goal to cleanup installed services
  
  Revision  Changes    Path
  1.7       +190 -20   jakarta-turbine-maven/src/plugins-build/webserver/apache-2.x.jelly
  
  Index: apache-2.x.jelly
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-maven/src/plugins-build/webserver/apache-2.x.jelly,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- apache-2.x.jelly	4 Dec 2002 19:28:24 -0000	1.6
  +++ apache-2.x.jelly	23 Jan 2003 20:28:07 -0000	1.7
  @@ -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">
  -    <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>
   
  -  </project>
  +  <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>