为了回答我自己,我现在使用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