将spring boot war部署到openshift在线

时间:2016-10-22 06:04:59

标签: spring maven spring-boot openshift

我按照此链接将简单的spring boot项目安装到openshift online。但是,我无法让它发挥作用。

http://www.sothawo.com/2015/09/deploying-a-spring-boot-application-running-with-java8-on-openshift2/

这是我的项目结构和我在git push

时看到的异常
git push
Counting objects: 14, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (9/9), done.
Writing objects: 100% (14/14), 1.82 KiB | 0 bytes/s, done.
Total 14 (delta 1), reused 0 (delta 0)
remote: Stopping DIY cartridge
remote: CLIENT_RESULT: Application is already stopped
remote: Repairing links for 1 deployments
remote: Building git ref 'master', commit 8e5a152
remote: [ERROR] Error executing Maven.
remote: [ERROR] The specified user settings file does not exist: /var/lib/openshift/580abfc589f5cf2be2000061/app-root/runtime/repo/.openshift/settings.xml
remote: An error occurred executing 'gear postreceive' (exit code: 1)
remote: Error message: CLIENT_ERROR: Failed to execute action hook 'build' for 580abfc589f5cf2be2000061 application pointingpoker
remote: 
remote: For more details about the problem, try running the command again with the '--trace' option.

enter image description here

更新

是,目标文件夹为红色。我已经将构建脚本修改为下面,我看到这个异常部署到openshift。我认为构建脚本已被修改为指向java8,但我仍然使用1.7

# call our own mvn script with the right settings
cd $OPENSHIFT_REPO_DIR
mvn package -X .openshift/settings.xml -DskipTests=true
  

控制台例外

 git push
Counting objects: 5, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (5/5), done.
Writing objects: 100% (5/5), 509 bytes | 0 bytes/s, done.
Total 5 (delta 3), reused 0 (delta 0)
remote: Stopping DIY cartridge
remote: CLIENT_RESULT: Application is already stopped
remote: Repairing links for 1 deployments
remote: Building git ref 'master', commit f5f3e76
remote: Apache Maven 3.0.4 (r1232336; 2012-12-18 14:36:37-0500)
remote: Maven home: /usr/share/java/apache-maven-3.0.4
remote: Java version: 1.7.0_111, vendor: Oracle Corporation
remote: Java home: /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.111/jre
remote: Default locale: en_US, platform encoding: ANSI_X3.4-1968
remote: OS name: "linux", version: "2.6.32-642.4.2.el6.x86_64", arch: "i386", family: "unix"
remote: [INFO] Error stacktraces are turned on.
remote: [DEBUG] Reading global settings from /usr/share/java/apache-maven-3.0.4/conf/settings.xml
remote: [DEBUG] Reading user settings from /var/lib/openshift/580abfc589f5cf2be2000061/.m2/settings.xml
remote: [DEBUG] Using local repository at /var/lib/openshift/580abfc589f5cf2be2000061/.m2/repository
remote: [ERROR] Could not create local repository at /var/lib/openshift/580abfc589f5cf2be2000061/.m2/repository -> [Help 1]
remote: org.apache.maven.repository.LocalRepositoryNotAccessibleException: Could not create local repository at /var/lib/openshift/580abfc589f5cf2be2000061/.m2/repository
remote:         at org.apache.maven.DefaultMaven.validateLocalRepository(DefaultMaven.java:504)
remote:         at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:196)
remote:         at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
remote:         at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
remote:         at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
remote:         at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
remote:         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
remote:         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
remote:         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
remote:         at java.lang.reflect.Method.invoke(Method.java:606)
remote:         at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
remote:         at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
remote:         at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
remote:         at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
remote: [ERROR] 
remote: [ERROR] 
remote: [ERROR] For more information about the errors and possible solutions, please read the following articles:
remote: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/LocalRepositoryNotAccessibleException
remote: An error occurred executing 'gear postreceive' (exit code: 1)
remote: Error message: CLIENT_ERROR: Failed to execute action hook 'build' for 580abfc589f5cf2be2000061 application pointingpoker
remote: 
remote: For more details about the problem, try running the command again with the '--trace' option.

enter image description here

1 个答案:

答案 0 :(得分:0)

根据文件结构的屏幕截图,您在.之前有一个前导settings.xml(点)。这似乎可能导致您的问题