How to deploy Spring MVC project on openshift.com

I wanted to Expand a simple Spring MVC APP to open the shift I was looking for for this, and found spring-mvc-3-on-jboss , but the project structure is different there. I have a basic Spring MVC project structure
enter image description here

that is, this repo , on openshift.com I created an application and configured it as:

But I do not see the home.jsp file as a welcome file when I have my application url. I see only the default / traditional greeting welcome page.
Is there any suggestion on how to properly configure the project?

+5
source share
2 answers

There is one serious problem with your pom.xml, I think your application does not work on 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 have not tested this code with the JBoss Application Server , so change your server to Apache Tomcat 7 . which worked for me correctly.

+2
source

first you clone your git repository, then automatically create a folder in the document folder.

then your war file will exit your clone directory in the webapps folder

and create a test folder, paste your code into the folder, as well as the root war file.

then your ulr in your folder will write and enter.

eg

like this.

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

Paste the extracted warrior file into your clone directory.

then fire git commmand

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

Source: https://habr.com/ru/post/1210271/


All Articles