gradle-spoon-plugin icon indicating copy to clipboard operation
gradle-spoon-plugin copied to clipboard

Including spoon in buildSrc dependencies causes build to fail

Open mattinger opened this issue 3 years ago • 3 comments

Gradle Version: 6.7.1 Android Plugin Version: 4.2.1

Including the spoon plugin jar in the dependencies of buildSrc/build.gradle.kts

 implementation("com.jaredsburrows:gradle-spoon-plugin:1.5.1")

will cause the build to fail with the following error:

Configure project :app
Error loading androidx migration mapping: org/w3c/dom/ElementTraversal
> Task :app:mergeDebugResources FAILED

This worked previously in 4.0.1 / gradle 6.6.x

I tried including xml-apis directly thinking maybe it would get that in the classpath, but it did not change the outcome

mattinger avatar May 24 '21 23:05 mattinger

More specifically, it looks like i can produce this merely by including the spoon-runner dependency. I realize that's not directly part of this plugin, but it does cause the plugin to be broken under the latest android gradle plugin.

mattinger avatar May 24 '21 23:05 mattinger

What is the use case for applying this in the buildSrc? To make it shared across projects?

jaredsburrows avatar Apr 24 '22 20:04 jaredsburrows

I experienced the same issue Gradle Version: 6.7.1 Android Plugin Version: 4.2.2

My usecase is on a project with multiple subprojects I found this reference: https://stackoverflow.com/questions/17515333/noclassdeffounderror-org-w3c-dom-elementtraversal using classpath ('com.jaredsburrows:gradle-spoon-plugin:1.5.0') { exclude module: "xml-apis" } has worked but seems like a workaround

agirl925 avatar May 26 '23 08:05 agirl925

This works after I release a new version fixing the build from this change https://github.com/jaredsburrows/gradle-spoon-plugin/issues/121 / https://github.com/jaredsburrows/gradle-spoon-plugin/pull/301:

plugins {
  `kotlin-dsl`
}

repositories {
  mavenCentral()
  gradlePluginPortal()
  google()
  maven { url = uri("https://oss.sonatype.org/content/repositories/snapshots") }
}

dependencies {
  implementation("com.jaredsburrows:gradle-spoon-plugin:1.5.1")
}

jaredsburrows avatar Jul 31 '24 16:07 jaredsburrows