自定义Ant任务不适用于构建服务器

时间:2017-02-28 19:53:28

标签: 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.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文件,它只在错误中提到一个。有没有人对可能发生的事情有任何想法?

0 个答案:

没有答案