【问题标题】:IntelliJ and jenkins pipeline shared library projectIntelliJ 和 jenkins 管道共享库项目
【发布时间】:2023-04-05 07:56:01
【问题描述】:

我刚开始使用 IntelliJ,我的 SharedLibrary 越来越大,所以我想迁移到 IDE。我得到 *.gdsl 用于自动完成等(基本的东西工作:))

但是,当我的脚本使用 @Library 表示法时,我得到了错误(无法解析符号等),我在 java 世界(.net 每日)中是“孩子”,我想我缺少一些 Jenkins 依赖项,但是哪个?

build.gradle

repositories {
    maven { url 'http://repo.jenkins-ci.org/releases/'}
    maven { url 'http://updates.jenkins-ci.org/download/plugins/'}
    maven { url 'http://jenkins-updates.cloudbees.com/download/plugins/'}
    mavenCentral()
}

dependencies {
    compile 'org.codehaus.groovy:groovy-all:2.3.11'
    testCompile group: 'junit', name: 'junit', version: '4.12'
    compile 'org.jenkins-ci.main:jenkins-core:2.97'
    compile 'org.jenkins-ci.plugins:pipeline-input-step:2.5'
    compile 'org.jenkins-ci.plugins.workflow:workflow-cps:2.1'
    compile 'org.jenkins-ci.plugins:credentials-binding:1.10'
    compile fileTree(dir: 'lib', include: ['*.jar'])
}

这个项目只能与 SharedLibrary 一起使用,没有别的 :) 有什么提示吗?

【问题讨论】:

    标签: jenkins intellij-idea shared-libraries


    【解决方案1】:

    将注解类库的规范导入添加到 Jenkinsfile(位于 workflow-cps-global-lib.jar 中)

    import org.jenkinsci.plugins.workflow.libs.Library

    比使用@Library 注解没有编译错误。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2022-01-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多