【问题标题】:how to deploy Spring MVC project on openshift.com如何在 openshift.com 上部署 Spring MVC 项目
【发布时间】:2015-06-20 12:43:39
【问题描述】:

我想部署一个简单的 Spring MVC APP 来打开班次我用谷歌搜索并找到了spring-mvc-3-on-jboss,但项目结构不同我有基本的 Spring MVC 项目结构是


this repo,在 openshift.com 我创建了应用程序并配置为:

但是当我转到我的 app-url 时,我看不到我的 home.jsp 文件作为欢迎文件,我只看到默认/传统欢迎页面。
有什么建议可以配置项目以使其正常工作吗?

【问题讨论】:

    标签: java spring-mvc openshift


    【解决方案1】:

    您的 pom.xml 存在一个主要问题,我认为这会使您的应用无法在 openshift.com 上运行。您应该将以下行添加到您的 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。这对我来说是正确的。

    【讨论】:

    • 我已经厌倦了这种方式,但我仍然无法让我的应用程序正常工作。请你帮我做这件事,我会将你添加为我的项目的贡献者。加我g+ 我们将在那里做进一步的步骤。
    【解决方案2】:

    首先你已经克隆了你的 git 存储库,然后在文档文件夹中自动创建了文件夹。

    然后你的war文件解压并通过你的克隆目录进入webapps文件夹

    并创建测试文件夹将您的代码粘贴到文件夹和根战争文件中。

    然后在你的文件夹名称中输入你的 ulr 并输入。

    例如

    像这样。

    git clone ssh://5565c850e0b8cd07580001ba@yourdomain.rhcloud.com
    

    将提取的war文件粘贴到克隆目录中。

    然后触发 git 命令

    $ git add .
    $ git commit -m "A checkin to my application"
    $ git push
    

    【讨论】:

    • 我已经从 github 推送了那个 repo 如何得到这个工作?
    • 你有推送回购然后部署成功你的应用程序消息在终端。然后在浏览器中打开。
    • 对不起,我没有得到你想说的,但我的本地机器上没有任何 repo 副本,我已经从 github.com 推送了!
    • 你已经给出了github的源代码,但是openshift进入不需要给出github源代码。他们已经在 openshift 中内置了 git。
    • 查看我的编辑并考虑一下!这个怎么办??
    猜你喜欢
    • 2013-09-27
    • 2015-06-16
    • 1970-01-01
    • 2020-03-30
    • 1970-01-01
    • 1970-01-01
    • 2013-05-28
    • 1970-01-01
    • 2017-03-07
    相关资源
    最近更新 更多