.htaccess 从maven启动和结束Apache Web服务器
我有一个旧的web项目,目前正在进行专业化。这是为ApacheHttpd编写的,这意味着许多规则都存在于许多.htaccess文件(重定向、重写)和服务器端包含的页面中。我尝试将jetty与HTAccessHandler一起使用,但这与重写/重定向无关。我想我现在需要使用httpd来正确处理它,但是有没有一种方法可以从maven启动嵌入的apachewebserver呢?或者您知道可以处理所有.htaccess属性的java Web服务器实现吗 干杯,.htaccess 从maven启动和结束Apache Web服务器,.htaccess,maven,webserver,.htaccess,Maven,Webserver,我有一个旧的web项目,目前正在进行专业化。这是为ApacheHttpd编写的,这意味着许多规则都存在于许多.htaccess文件(重定向、重写)和服务器端包含的页面中。我尝试将jetty与HTAccessHandler一起使用,但这与重写/重定向无关。我想我现在需要使用httpd来正确处理它,但是有没有一种方法可以从maven启动嵌入的apachewebserver呢?或者您知道可以处理所有.htaccess属性的java Web服务器实现吗 干杯, Kai我查看了各种新闻组,因为我们的社区中
Kai我查看了各种新闻组,因为我们的社区中有相同的功能要求 我们将在未来几天开始开发一个httpd插件。然而,我试图在谷歌上找到一些东西,但似乎没有一个插件可以涵盖这个主题。开发一个插件来启动和停止apache应该相当简单。自从Maven java以来,我很清楚为什么几乎每个人都喜欢tomcat或jetty 针对php maven的2.0版 该插件将类似于jetty和tomcat插件(相同的目标,相似的设置)。第一个版本将取决于单独安装的apache,并且只设置虚拟主机或设置文档根目录。对于简单的配置和开发机器,这是可以的 观看或观看新闻
但是,请在(需要注册)或我们的谷歌小组提交您的愿望。为了回答我自己,我现在使用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>
maven antrun插件
1.7
启动Apache
预集成测试
跑
正在启动Apache httpd:
阻止Apache
整合后测试
跑
正在停止Apache httpd:
在不同的端口上运行apache,并将Maven设置为代理这些“旧”网站的请求。但是我建议把这个问题贴在服务器上