爲了回答我自己,我現在使用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>
來源
2012-02-26 23:19:39
Kai
在另一個端口上運行Apache,並設置Maven代理請求這些「舊」的網站。但我會建議在ServerFault上發佈這個問題 – Gerben 2012-02-21 17:45:31