openshift上传java web项目

下载当前客户端

OC(Openshift Client)

https://mirror.openshift.com/pub/openshift-v3/clients/3.9.14/windows/oc.zip

1 切换到oc所在目录。

2 登录控制台以后在你的用户名上面点击"Copy Login command"

3 在命令行运行 oc login https://api.starter-us-west-2.openshift.com --token=83bfawHxr62xB-FXRIDjDvjcJVyworVNq9xpKtqJu2o

4 输入你的帐号及密码

oc-new porject javaweb

oc new-app wildfly:latest~. --name myhelloworld 新建应用服务器

oc start-build myhelloworld --from-file=d:helloworld.war 上传war包

oc expose svc myhelloworld 使项目对公网可见

oc get routes 查看项目部署情况,以下是博主部署的项目

oc get routes
NAME           HOST/PORT                                                      PATH      SERVICES       PORT       TERMINATION   WILDCARD
myhelloworld   myhelloworld-jdk180.7e14.starter-us-west-2.openshiftapps.com              myhelloworld   8080-tcp                 None

  博主刚刚部署的war名是 helloworld

在浏览器只要输入http://myhelloworld-jdk180.7e14.starter-us-west-2.openshiftapps.com/helloworld即可访问。

效果如下

 参考网址:https://blog.openshift.com/deploying-war-file-openshift-online-3/

原文地址:https://www.cnblogs.com/passedbylove/p/8745773.html