Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试使用 groovy 创建一个 Jenkins 流水线脚本。但是,该import语句给了我一个编译错误-未知类型:导入。不知道为什么。
import
您应该import jxl.*在管道脚本的顶部定义,例如
import jxl.*
import jxl.* node { stage('Execute Tests') { try { dir('.') { sh '......' // etc. } } } }
当您将它添加到node {}块中时,Jenkins 正在寻找一种方法而不是 import class 语句。好的约定是将所有导入语句放在 Groovy 文件的顶部。
node {}