2012-02-21 52 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>