how to deploy Spring MVC project on openshift.com

2019-02-17 16:22发布

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
enter image description here

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?

2条回答
别忘想泡老子
2楼-- · 2019-02-17 16:39

first you have clone your git repository then automatically created folder in document folder.

then your war file extract and past your clone directory into webapps folder

and create test folder paste your code in folder and also root war file.

then your ulr in your folder name write and enter.

for example

like this.

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

paste your extract war file into your clone directory.

then fire git commmand

$ git add .
$ git commit -m "A checkin to my application"
$ git push
查看更多
不美不萌又怎样
3楼-- · 2019-02-17 17:02

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>

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

查看更多
登录 后发表回答