【发布时间】:2015-05-26 02:14:18
【问题描述】:
当我在脚本控制台中运行简单语句时,我可以看到打印的输出,例如
println "hello"
但是,使用此代码,我在 Jenkins 脚本控制台中运行时看不到任何输出。你知道为什么吗 ?从计算机命令行运行时,代码打印得很好。
class Product{
private String name
private def price
def vendor
public Product(){
}
Product(name, price, String vendor){
println "Constructor";
this.name = name
this.price = price
this.vendor = vendor
}
public String getName(){
return name
}
def setName(name){
this.name = name
}
public String getPrice(){
return price
}
def setPrice(price = 100.00){
this.price = price
}
def String toString(){
return "Name = $name, Price = $price, Vendor = $vendor";
}
static main(arguments){
def p1 = new Product("Mobile", "10000", "Nokia")
println(p1.toString())
println "Hello"
}
}
【问题讨论】: