当前位置:   article > 正文

Jenkins 发布kubernetes的Pod报错Class not found: io.kubernetes.client.openapi.models.V1Deployment_unexpected unknown resource type: class io.kuberne

unexpected unknown resource type: class io.kubernetes.client.openapi.models.
一、Jenkins 发布kubernetes的Pod报错Class not found: io.kubernetes.client.openapi.models.V1Deployment

问题:

Loading configuration: /var/jenkins_home/workspace/JIC_Open_Test/project_dev.yaml
ERROR: ERROR: Can’t construct a java object for tag:yaml.org,2002:io.kubernetes.client.openapi.models.V1Deployment; exception=Class not found: io.kubernetes.client.openapi.models.V1Deployment
in ‘reader’, line 1, column 1:
apiVersion: apps/v1

在这里插入图片描述

解决:

  1. git clone https://github.com/jenkinsci/jackson2-api-plugin【选择你需要的版本】

  2. 删除根pom一下内容

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>io.jenkins.tools.bom</groupId>
        <artifactId>bom-2.222.x</artifactId>
        <version>887.vae9c8ac09ff7</version>
        <scope>import</scope>
        <type>pom</type>
      </dependency>
    </dependencies>
  </dependencyManagement>

    <dependency>
      <groupId>com.fasterxml.jackson.dataformat</groupId>
      <artifactId>jackson-dataformat-yaml</artifactId>
      <version>${jackson.version}</version>
      <exclusions>
        <exclusion>
          <groupId>org.yaml</groupId>
          <artifactId>snakeyaml</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <dependency>
      <groupId>io.jenkins.plugins</groupId>
      <artifactId>snakeyaml-api</artifactId>
    </dependency>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  1. 执行mvn clean install打包

有可能会build失败,报错[ERROR] Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin:3.0.0-M3:enforce (display-info) on project jackson2-api: Some Enforcer rules have failed. Look above for specific messages explaining why the rule failed. -> [Help 1]
!!在CommandLine填写 install -Denforcer.skip=true
选择该配置执行
在这里插入图片描述

  1. 将target中jackson2-api.hpi上传至jenkins插件
    在这里插入图片描述

来源:https://www.jianshu.com/p/e4babf288d01

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小小林熬夜学编程/article/detail/353769
推荐阅读
相关标签
  

闽ICP备14008679号