我在 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()