Custom Ant Task Works Correctly Locally But Not On Build Server


(Allen Fisher) #1

Hello, Forum…

I’ve got a custom Ant task that I’m using successfully on my local machine:

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)
  }
}

I’ve got the jar files sitting next to build.gradle for now, out of simplicity… they exist in the same location on the build server. Works great locally. When I run my build from my build server (either through Jenkins or going on the box and running Gradle directly), I get the following:

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

What concerns me is that there are two jar files in the classpath and it only mentions one in the error. Does anyone have any ideas as to what might be going on?