一、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
解决:
-
git clone https://github.com/jenkinsci/jackson2-api-plugin【选择你需要的版本】
-
删除根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>
- 执行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
选择该配置执行
- 将target中jackson2-api.hpi上传至jenkins插件
来源:https://www.jianshu.com/p/e4babf288d01