这就是我最终做的方式。我将原始
web.xml文件重命名为
web-openshift.xml。在OpenShift中构建项目时,将使用maven
openshift配置文件。您可以
<profiles>在pom.xml 的部分中找到它。所以我给我添加了一行
pom.xml:
<build> <plugins> <plugin> <artifactId>maven-war-plugin</artifactId> <configuration> ....<webXml>src/main/webapp/WEB-INF/web-openshift.xml</webXml> <!--add this-->
这使得在构建战争时
maven-war-plugin将
web-openshift.xml文件用作Web部署描述符。然后我添加了一个
web.xml文件,该文件将用于本地构建。在这些文件中,您可以通过以下方式配置servlet:
<init-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/jboss-as-spring-mvc-context.xml</param-value>
因此,通过更改
<param-value>两个
web.xml文件中的,我能够以不同的方式配置Spring和Hibernate。
然后,我添加标记为jar
<provided>在
pom.xml到
lib我的Tomcat的安装目录。现在,我能够将应用程序部署并运行到OpenShift和Tomcat。



