2012-02-21 69 views
0

我有一个旧的web项目,我目前正在进行试验。这是为Apache httpd编写的,这意味着许多规则都坐在许多.htaccess文件中(重定向,重写),并且这些页面使用服务器端包含。我试图用HTAccessHandler使用jetty,但这不关心重写/重定向。我想我现在需要使用httpd来正确处理,但是有没有办法启动从maven嵌入的apache webserver?或者你知道一个可以处理所有.htaccess属性的java webserver实现吗?从maven开始和结束Apache webserver

干杯, 凯

+0

在另一个端口上运行Apache,并设置Maven代理请求这些“旧”的网站。但我会建议在ServerFault上发布这个问题 – Gerben 2012-02-21 17:45:31

回答

0

我看了一下不同的新闻组,因为我们有相同的功能要求在我们的社会

我们将开始发展,在未来几天的httpd-插件。不过,我试图找到谷歌的东西,但似乎没有涵盖此主题的插件。开发一个插件来启动和停止apache应该相当简单。由于Maven的Java,我很清楚为什么几乎每个人都喜欢tomcat或jetty。

针对PHP-行家

的2.0版本的插件将类似于码头和Tomcat插件(相同的目标,类似的设置)。第一个版本将取决于单独安装的apache,并且只会设置虚拟主机或设置文档根目录。对于简单的配置和开发机器,这将是确定的。

手表http://www.php-maven.org/rss.xmlhttps://groups.google.com/forum/?fromgroups#!forum/maven-for-php的消息。

但是,请在http://trac.php-maven.org/ticket/47(需要注册)或我们的谷歌群组提交您的意愿。

2

为了回答我自己,我现在使用antrun插件启动Apache httpd二进制文件并使用Apache创建的pid文件调用系统特定的kill命令。我为我的项目提供了一个httpd.conf文件,用于过滤maven属性,包括目标端口,日志位置和pidfile名称和位置。系统特定的值由os系列激活的maven配置文件设置。 apache httpd的主文件夹将在users settings.xml文件中设置。这看起来像:

 <plugin> 
      <artifactId>maven-antrun-plugin</artifactId> 
      <version>1.7</version> 
      <executions> 
       <execution> 
        <id>Starting Apache</id> 
        <phase>pre-integration-test</phase> 
        <goals> 
         <goal>run</goal> 
        </goals> 
        <configuration> 
         <target name="Starting Apache"> 
          <mkdir dir="${project.build.directory}/logs" /> 
          <echo>Starting Apache httpd:</echo> 
          <exec executable="${apache.home}/${apache.executable}" spawn="true"> 
           <arg value="-f" /> 
           <arg value="${project.build.directory}/httpd.conf" /> 
          </exec> 
         </target> 
        </configuration> 
       </execution> 
       <execution> 
        <id>Stopping Apache</id> 
        <phase>post-integration-test</phase> 
        <goals> 
         <goal>run</goal> 
        </goals> 
        <configuration> 
         <target name="Stopping Apache"> 
          <echo>Stopping Apache httpd:</echo> 
          <loadfile property="PID" srcFile="${project.build.directory}/httpd.pid"> 
           <filterchain> 
            <striplinebreaks /> 
           </filterchain> 
          </loadfile> 
          <exec executable="${kill.executable}" failonerror="true"> 
           <arg value="${kill.argument1}" /> 
           <arg value="${kill.argument2}" /> 
           <arg value="${kill.argument3}" /> 
           <arg value="${PID}" /> 
          </exec> 
         </target> 
        </configuration> 
       </execution> 
      </executions> 
     </plugin>