Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/31.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jenkins 自定义Ant任务在生成服务器上不工作_Jenkins_Gradle - Fatal编程技术网

Jenkins 自定义Ant任务在生成服务器上不工作

Jenkins 自定义Ant任务在生成服务器上不工作,jenkins,gradle,Jenkins,Gradle,我有一个自定义Ant任务,我正在本地计算机上从gradle成功使用它: task fetchRelMod { doLast { println 'Fetching the RelMod' ant.taskdef(name:'relmod', classpath:'retrievePBSInfo.jar:hsjt400-4-9.jar', classname:"com.myco.ant.tasks.Retrieve

我有一个自定义Ant任务,我正在本地计算机上从gradle成功使用它:

task fetchRelMod {
  doLast {
    println 'Fetching the RelMod'
    ant.taskdef(name:'relmod',
                classpath:'retrievePBSInfo.jar:hsjt400-4-9.jar',
                classname:"com.myco.ant.tasks.RetrievePBSRelModString")
    ant.relmod(user:project.ext.props.getProperty('fetchrelmod.username'),
               password:project.ext.props.getProperty('fetchrelmod.password'),
               prodCode:project.ext.props.getProperty('profile.pbs.product.code'),
               branch:project.ext.props.getProperty('profile.pbs.branch'),
               state:project.ext.props.getProperty('profile.pbs.relmod.selector'))
    project.ext.set('iseries_relmod',ant.relmodStub)
    project.ext.set('iseries_relmodAndDate', ant.relmod)
  }
}
为了简单起见,我现在把jar文件放在build.gradle旁边。。。它们存在于生成服务器上的同一位置。在当地很管用。当我从构建服务器运行构建时(通过Jenkins或直接运行Gradle),我会得到以下结果:

sudo /var/lib/jenkins/tools/hudson.plugins.gradle.GradleInstallation/gradle214/bin/gradle all -DisQUABuild=true
Building My App
Loading Properties files...
QUA Build. Using build-qua.props
:fetchRelMod
Fetching the RelMod
:fetchRelMod FAILED

FAILURE: Build failed with an exception.

* Where:
Build file '/var/lib/jenkins/workspace/MyApp/build.gradle' line: 141

* What went wrong:
Execution failed for task ':fetchRelMod'.
> taskdef class com.myco.ant.tasks.RetrievePBSRelModString cannot be found
  using the classloader AntClassLoader[/var/lib/jenkins/workspace/myApp/hsjt400-4-9.jar]

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 3.104 secs

我关心的是类路径中有两个jar文件,它在错误中只提到一个。有人对可能发生的事情有什么想法吗?

只是一个猜测,您是否在平面目录上使用mavenLocal作为依赖项?也许值得在你的问题中添加这一部分。它不是使用MavenLocal。真的很奇怪。。。如果我再次添加依赖项,使其在其中出现两次,它将工作并拾取新的依赖项。这很奇怪,直到您找到原因:)但是我担心,如果没有完整的脚本,它将不可能。尝试运行
gradle dependencies
并添加“---debug”标志。通常要经历很多,但它可以给你一些想法。