IntelliJ和Jenkins管道共享库项目

kkk*_*uba 5 intellij-idea shared-libraries jenkins

我只是开始使用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'])
}
Run Code Online (Sandbox Code Playgroud)

该项目将仅与SharedLibrary一起使用,其他::有什么提示吗?

小智 2

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

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

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

在此输入图像描述