我在IntelliJ IDE中开发了groovy类,我想在' Pipeline script'中实例化其中一个类。 Jenkins的Pipeline插件我试着按照' 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()