From this Forum Post I see that all the transitive dependencies of the plugin are added to the classpath of the of the build where it is applied. I am right now running into a issue where my plugin’s transitive dependencies are not applied to my build where I am using it.
In my case my custom plugin is a standalone plugin and its published to local maven repository and I am using published plugin in another build.
- plugin
build.gradle
buildscript {
repositories {
ivy {
url 'https://bndtools.ci.cloudbees.com/job/bnd.master/lastSuccessfulBuild/artifact/dist/bundles'
layout 'pattern', { artifact '[module]/[artifact]-[revision].[ext]' /* OSGi repo pattern */ }
}
mavenCentral()
}
dependencies {
classpath group:'biz.aQute.bnd', name: 'biz.aQute.bnd', version: '3.0.0'
classpath group: 'biz.aQute.bnd', name: 'biz.aQute.bnd.gradle', version: '3.0.0'
}
}
apply plugin: 'groovy'
apply plugin: 'maven-publish'
sourceCompatibility = 1.7
targetCompatibility = 1.7
version = '1.0-SNAPSHOT'
repositories {
ivy {
url 'https://bndtools.ci.cloudbees.com/job/bnd.master/lastSuccessfulBuild/artifact/dist/bundles'
layout 'pattern', { artifact '[module]/[artifact]-[revision].[ext]' /* OSGi repo pattern */ }
}
mavenCentral()
jcenter()
}
dependencies {
compile gradleApi()
compile localGroovy()
compile 'biz.aQute.bnd:biz.aQute.bnd:3.0.0'
compile 'biz.aQute.bnd:biz.aQute.bnd.gradle:3.0.0'
compile 'commons-io:commons-io:2.4'
compile 'org.freemarker:freemarker:2.3.22'
testCompile group: 'junit', name: 'junit', version: '4.+'
}
publishing {
publications {
maven(MavenPublication) {
groupId 'org.workspace7.gradle'
artifactId 'osgidoc-plugin'
version "${version}"
artifact jar
}
}
}
– plugin consumer build.gradle
buildscript {
repositories {
ivy {
url 'https://bndtools.ci.cloudbees.com/job/bnd.master/lastSuccessfulBuild/artifact/dist/bundles'
layout 'pattern', { artifact '[module]/[artifact]-[revision].[ext]' /* OSGi repo pattern */ }
}
mavenLocal()
mavenCentral()
}
dependencies {
classpath 'biz.aQute.bnd:biz.aQute.bnd.gradle:3.0.0'
classpath group:'org.workspace7.gradle',name:'osgidoc-plugin',version:'1.0-SNAPSHOT'
}
}
apply plugin: 'org.workspace7.gradle.plugins.osgidoc'
sourceCompatibility = 1.7
repositories { mavenCentral() }
dependencies {
compile 'org.osgi:org.osgi.core:6.0.0'
compile 'org.osgi:org.osgi.compendium:5.0.0'
compile 'biz.aQute.bnd:biz.aQute.bnd.annotation:2.4.0'
compile 'org.slf4j:slf4j-api:1.7.7'
}
task wrapper(type:Wrapper){ gradleVersion = '2.4' }
Exception with --stacktrace option has this Caused by: java.lang.ClassNotFoundException: freemarker.template.Template
- which I suppose the plugins dependencies are not added to classpath. An observation noted that the generated pom.xml does not have any dependencies
section too .
Any pointers on why its not working is much appreciated.
-Kamesh