我希望有人可以提供帮助。我试图编译詹金斯/哈德森一个简单的插件,将在从执行代码,但是这个代码块未能编译:试图声明时,编译时使用Java和Maven编译Jenkins插件时出错
// Define what should be run on the slave for this build
Callable<String, IOException> task = new Callable<String, IOException>() {
public String call() throws IOException {
// This code will run on the build slave
return InetAddress.getLocalHost().getHostName();
}
};
// Get a "channel" to the build machine and run the task there
String hostname = launcher.getChannel().call(task);
我发现了一个异常可调用变量Task。错误是'错误:错误的类型参数数量;需要1'。
我对创建jenkins插件和Java都很陌生,所以我希望有更多经验的人可以帮助我。我已经广泛搜索,文档表明我正在做正确的事情(http://grepcode.com/file/repo1.maven.org/maven2/org.jvnet.hudson.main/remoting/1.366/hudson/remoting/Callable.java#Callable),这就是为什么我卡住了。
谢谢你的时间。
你是否以某种方式编译'java.util.concurrent.Callable'而不是'hudson.remoting.Callable'? –
嗨,尼克,这正是我的问题。我已经切换到导入后者,并且它的所有内容都正确构建。如果你可以添加这个答案,那么我可以将其标记为已解决。谢谢! – ChrisD88
作为回答添加,很高兴帮助。 –