Error 'unable to resolve class' from plugin

Its seems likely that I have a classpath problem. If I use

import org.gradle.api.plugins.shadow.transformers.AppendingTransfomer

i get

What went wrong: Could not compile build file 'C:\dev\github\thredds\tdm\build.gradle'. > startup failed: build file 'C:\dev\github\thredds\tdm\build.gradle': 2: unable to resolve class org.gradle.api.plugins.shadow.transformers.AppendingTransfomer @ line 2, column 1. import org.gradle.api.plugins.shadow.transformers.AppendingTransfomer

however, the shadow-0.7.4.jar gets downloaded fine, and the ‘missing’ class is present in the jar, and shadow runs fine as long as i dont use

transformer(AppendingTransfomer) {
resource = 'META-INF/spring.handlers'
}

Its as if the jar is present at gradle runtime but not gradle compile(?) . Im really unclear how gradle works internally.

Where is this class coming from?

Heres the subproject build.gradle:

apply plugin: ‘shadow’ import org.gradle.api.plugins.shadow.transformers.AppendingTransfomer

buildscript {

repositories {

maven {

name ‘Gradle Shadow’

url ‘http://dl.bintray.com/content/johnrengelman/gradle-plugins

}

}

dependencies {

classpath group: ‘org.gradle.plugins’, name: ‘shadow’, version: ‘0.7.4’

} }

dependencies {

compile project(’:cdm’)

compile project(’:grib’)

compile project(’:tdcommon’)

compile ‘log4j:log4j:1.2.17’

runtime ‘org.slf4j:slf4j-log4j12:1.7.5’

compile (‘org.springframework:spring-core:3.1.1.RELEASE’)

compile (‘org.springframework:spring-context:3.1.1.RELEASE’)

compile (‘org.springframework:spring-beans:3.1.1.RELEASE’) }

ext {

tdmJar = ‘tdm-’+version+’.jar’ }

shadow {

exclude ‘com/sleepycat/**’

exclude ‘net/sf/**’

exclude ‘org/jsoup/**’

exclude ‘org/quartz/**’

exclude ‘META-INF/*.DSA’

exclude ‘META-INF/*.RSA’

manifest {

attributes ‘Implementation-Title’: tdmJar,

‘Implementation-Version’: version,

‘Implementation-Vendor’: ‘UCAR/Unidata’,

‘Implementation-Vendor-Id’: ‘edu.ucar’,

‘Built-On’: new Date(),

‘Main-Class’: ‘thredds.tdm.TdmRunner’

}

transformer(AppendingTransfomer) {

resource = ‘META-INF/spring.handlers’

}

transformer(AppendingTransfomer) {

resource = ‘META-INF/spring.schemas’

} }

and the main project:

subprojects {

apply plugin: ‘java’

sourceCompatibility = 1.6

version = ‘4.4.0’

repositories {

maven {

url “https://artifacts.unidata.ucar.edu/content/groups/unidata/

}

mavenCentral()

}

ext {

springVersion = “3.2.3.RELEASE”

}

// import fatJar

buildscript {

repositories {

mavenCentral()

}

dependencies {

classpath ‘eu.appsatori:gradle-fatjar-plugin:0.2-rc1’

}

}

jar {

manifest {

attributes ‘Implementation-Version’: version,

‘Implementation-Vendor’: ‘UCAR/Unidata’,

‘Implementation-Vendor-Id’: ‘edu.ucar’,

‘Built-On’: new Date()

}

}

}

Still stuck on this. Ive switched to gradle-1.7-rc-2 (no help).

The situation is that the shadow-0.7.4.jar is present and works fine, but i cant import from it in the build script, getting the error:

$ gradle show -x test -p tdm

FAILURE: Build failed with an exception.

  • Where: Build file ‘C:\dev\github\thredds\tdm\build.gradle’ line: 2

  • What went wrong: Could not compile build file ‘C:\dev\github\thredds\tdm\build.gradle’. > startup failed:

build file ‘C:\dev\github\thredds\tdm\build.gradle’: 2: unable to resolve class org.gradle.api.plugins.shadow.transformers.AppendingTransfomer

@ line 2, column 1.

import org.gradle.api.plugins.shadow.transformers.AppendingTransfomer

^

but i know its on the build script classpath because (without offending import), the output from

task show << {

buildscript.configurations.classpath.each { println it } }

is:

$ gradle show -x test -p tdm :tdm:show C:\Users\caron.gradle\caches\artifacts-26\filestore\org.gradle.plugins\shadow\0.7.4\jar\d511389a735f3172399275817b626049f918cfb3\shadow-0.7.4.jar C:\Users\caron.gradle\caches\artifacts-26\filestore\org.jdom\jdom\1.1\jar\1d04c0f321ea337f3661cf7ede8f4c6f653a8fdd\jdom-1.1.jar C:\Users\caron.gradle\caches\artifacts-26\filestore\asm\asm\3.3.1\jar\1d5f20b4ea675e6fab6ab79f1cd60ec268ddc015\asm-3.3.1.jar C:\Users\caron.gradle\caches\artifacts-26\filestore\asm\asm-tree\3.3.1\jar\c9723d887e26c3049944e46312bb39e7ab1a2ed2\asm-tree-3.3.1.jar C:\Users\caron.gradle\caches\artifacts-26\filestore\asm\asm-commons\3.3.1\jar\fae85e673c73f6f45386dbbcc2ae3aa6398a773f\asm-commons-3.3.1.jar

thanks for any help!

You misspelled the class name.

thanks (sheepish grin)