1

我在 IntelliJ IDE 中开发了 groovy 类,我想在 Jenkins 的管道插件的“管道脚本”中实例化这些类之一。我尝试按照“Eval.me”和 class.forName 的示例进行操作

Sample

package com.mycomp.tmo

/**
 * Created by
 */
public void callMe(){
    println("Hello World !")
}


def e = "callMe"
def cl = Class.forName("com.mycomp.tmo.Sample")
println(Eval.me("${c1} (${e})"))

下面也试过:

String cls = 'D:\\Users\\b\\IdeaProjects\\Automation\\src\\com\\mycomp\\tmo\\DBConnectionManager'

def map = ['person': ${cls}]
map['person'].newInstance()
4

1 回答 1

0

我想我两周前问的帖子可以回答你的问题。 创建可重复使用的詹金斯管道脚本

于 2016-08-05T13:02:54.927 回答