使用Java和Maven编译Jenkins插件时出错

使用Java和Maven编译Jenkins插件时出错,java,maven,jenkins,hudson,jenkins-plugins,Java,Maven,Jenkins,Hudson,Jenkins Plugins,我希望有人能帮忙。我正在尝试为Jenkins/Hudson编译一个简单的插件,该插件将在从机上执行代码,但是这段代码无法编译: // Define what should be run on the slave for this build Callable<String, IOException> task = new Callable<String, IOException>() { public String call() throws IOExceptio

我希望有人能帮忙。我正在尝试为Jenkins/Hudson编译一个简单的插件,该插件将在从机上执行代码,但是这段代码无法编译:

// 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);
//定义此版本应在从属服务器上运行的内容
可调用任务=新的可调用任务(){
公共字符串调用()引发IOException{
//此代码将在构建从属服务器上运行
返回InetAddress.getLocalHost().getHostName();
}
};
//获取到构建机器的“通道”,并在那里运行任务
字符串hostname=launcher.getChannel().call(任务);
我在声明可调用变量任务时尝试编译时遇到异常。错误为“错误:类型参数的数目错误;要求1’

我对创建jenkins插件和Java都是新手,所以我希望有更有经验的人能帮助我。我在谷歌上搜索了很多次,文档显示我做的是对的(),这就是为什么我被卡住了


谢谢您的时间。

您看到的是Jenkins代码的一个非常旧的版本。这里是c和e的链接


看起来您尝试使用的远程处理类已经不存在了。

您是针对“java.util.concurrent.Callable”而不是“hudson.Remoting.Callable”进行编译的吗?检查导入语句。

您是否以某种方式针对“java.util.concurrent.Callable”而不是“hudson.remoting.Callable”进行编译?嗨,尼克,这正是我的问题。我现在已经切换到导入后者,并且所有的构建都是正确的。如果你能加上这个作为答案,那么我可以把它标记为已解决。谢谢作为一个回答,很高兴它能帮上忙。嗨,加雷斯,虽然这不是问题(见上面尼克的评论),但有这些链接并查看一下肯定很方便,谢谢你。