Reputation: 129
I am writing a groovy script and trying to download jenkins-core module using Grapes but I am not able to.
@Grapes([
@Grab(group='org.jenkins-ci.main', module='jenkins-core', version='2.9')
])
import jenkins.model.Jenkins
It is giving me following error:
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: General error during conversion: Error grabbing Grapes -- [unresolved dependency: org.jenkins-ci.main#jenkins-core;2.9: not found]
java.lang.RuntimeException: Error grabbing Grapes -- [unresolved dependency: org.jenkins-ci.main#jenkins-core;2.9: not found]
I have tried other versions also but it didn't work. These version are available in maven repo. I would really appreciate if you could help me resolving the issue.
Upvotes: 4
Views: 2526
Reputation: 6977
As jenkins-core
is not available in maven central but in jenkins-ci
maven repository, you need to add http://repo.jenkins-ci.org
repository.
Grape
@GrabResolver(name='jenkins', root='http://repo.jenkins-ci.org/public/')
@Grab(group='org.jenkins-ci.main', module='jenkins-core', version='2.9')
import jenkins.model.Jenkins
Note: You need to be using groovy version 2.4.7
or higher to be able to grab jenkins-core
due to this fixed groovy bug
Gradle
Add a new maven repository for jenkins-ci.org
and the jenkins-core
dependency
repositories {
...
maven {
url 'http://repo.jenkins-ci.org/public/'
}
}
dependencies {
...
compile group: 'org.jenkins-ci.main', name: 'jenkins-core', version: '2.9'
}
Upvotes: 2