1

尝试构建 syndesis 时出现此错误,阻止我构建图像:

[INFO] --- fabric8-maven-plugin:3.5.38:build (build) @ meta ---
[INFO] F8: Using OpenShift build with strategy S2I
[WARNING] F8: Cannot access cluster for detecting mode: Failure executing: GET at: https://192.168.42.178:8443/. Message: Unauthorized! Token may have expired! Please log-in again. Unauthorized.
[INFO] F8: Running generator spring-boot
[INFO] F8: spring-boot: Using Docker image fabric8/s2i-java:2.1 as base / builder
[WARNING] F8: Cannot access cluster for detecting mode: Failure executing: GET at: https://192.168.42.178:8443/. Message: Unauthorized! Token may have expired! Please log-in again. Unauthorized.
[ERROR] F8: Failed to execute the build [io.fabric8.kubernetes.client.DefaultKubernetesClient cannot be cast to 
io.fabric8.openshift.client.OpenShiftClient]
   ...
[ERROR] Failed to execute goal io.fabric8:fabric8-maven-plugin:3.5.38:build (build) on project meta: Failed to execute the build: io.fabric8.kubernetes.client.DefaultKubernetesClient cannot be cast to io.fabric8.openshift.client.OpenShiftClient -> [Help 1]
    ...

用于构建 syndesis 的命令:syndesis build -i -f --clean-cache -c

4

1 回答 1

0

这是因为您已从“oc”命令中注销。如果你尝试使用它,你会得到这样的错误:

$ oc get pods
error: the server doesn't have a resource type "pods"

要修复它,您必须再次登录:

$ oc login
Authentication required for https://192.168.42.178:8443 (openshift)
Username: developer
Password: 
Login successful.

You have access to the following projects and can switch between them with 'oc project <projectname>':

    myproject
  * syndesis

Using project "syndesis".

如果无法识别命令“oc”,则必须先设置环境:

$ eval $(minishift oc-env)
于 2019-08-13T11:25:26.910 回答