私は今、antrunプラグインを使用してApache httpdバイナリを起動し、Apache固有のpidファイルを使用してシステム固有のkillコマンドを呼び出しています。私はターゲットポート、ログの場所、pidfileの名前と場所を含むmavenのプロパティをフィルタリングする私のプロジェクトにhttpd.confファイルを提供しています。システム固有の値は、osファミリによってアクティブ化されたMavenプロファイルによって設定されます。 apache httpdのホームフォルダは、ユーザーの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