如何在openshift.com上部署Spring MVC项目 [英] how to deploy Spring MVC project on openshift.com

查看:55
本文介绍了如何在openshift.com上部署Spring MVC项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想部署一个简单的Spring MVC APP来打开班次,为此我用Google搜索了一下,发现此仓库上,我创建了Application并将其配置为:

但是当我进入我的应用程序URL时,我看不到 home.jsp 文件作为欢迎文件,我只能看到默认/传统的欢迎页面.
关于如何配置项目以使其正常工作的任何建议?

I wanted to Deploy a simple Spring MVC APP to open shift I googled for this and found spring-mvc-3-on-jboss but there project structure is different I have basic Spring MVC project structure is


that is at this repo, at openshift.com I created Application and configured as :

But I can not see my home.jsp file as welcome file when I goto my app-url I see only the default/traditional welcome page.
Any suggestion how to configure project to work correctly?

推荐答案

您的pom.xml存在一个主要问题,我认为这会使您的应用无法在openshift.com上运行.您应该将以下行添加到pom.xml

There is one major problem with your pom.xml, I think that makes your app not working on the openshift.com. You should add the following lines to your pom.xml

<profiles>
    <profile>
        <!-- When built in OpenShift the 'openshift' profile will be used when 
            invoking mvn. -->
        <!-- Use this profile for any OpenShift specific customization your app 
            will need. -->
        <!-- By default that is to put the resulting archive into the 'webapps' 
            folder. -->
        <!-- http://maven.apache.org/guides/mini/guide-building-for-different-environments.html -->
        <id>openshift</id>
        <build>
            <finalName>yourAppName</finalName>
            <plugins>
                <plugin>
                    <artifactId>maven-war-plugin</artifactId>
                    <version>2.1.1</version>
                    <configuration>
                        <outputDirectory>webapps</outputDirectory>
                        <warName>ROOT</warName>
                    </configuration>
                </plugin>
            </plugins>
        </build>
    </profile>
</profiles>

我尚未使用JBoss Application Server测试此代码,因此将服务器更改为Apache Tomcat 7.正确地为我工作了.

I haven't tested this code with JBoss Application Server, so change your server to Apache Tomcat 7. that worked for me correctly.

这篇关于如何在openshift.com上部署Spring MVC项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆