Skip to content

Fix intermittent spotless NoClassDefFoundErrors after clean - #128

Merged
mcculls merged 2 commits into
mainfrom
mcculls/spotless-noclassdef-fix
Oct 2, 2026
Merged

mcculls merged 2 commits into
mainfrom
mcculls/spotless-noclassdef-fix

Conversation

@mcculls

@mcculls mcculls commented Oct 1, 2026

Copy link
Copy Markdown
Collaborator

Motivation

Fixes the following intermittent error, reproducible with ./gradlew clean build --no-build-cache

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':class-inject:spotlessJavaCheck' (registered by plugin 'java-common').
> There were 4 lint error(s), they must be fixed or suppressed.
  src/glue/java/datadog/instrument/glue/DefineClassGlueGenerator.java:LINE_UNDEFINED removeUnusedImports(java.lang.NoClassDefFoundError) com/google/googlejavaformat/java/RemoveUnusedImports (...)
  src/main/java/datadog/instrument/classinject/ClassInjector.java:LINE_UNDEFINED removeUnusedImports(java.lang.NoClassDefFoundError) com/google/googlejavaformat/java/RemoveUnusedImports (...)
  src/main/java/datadog/instrument/classinject/package-info.java:LINE_UNDEFINED removeUnusedImports(java.lang.NoClassDefFoundError) com/google/googlejavaformat/java/RemoveUnusedImports (...)
  src/test/java/datadog/instrument/glue/DefineClassGlueGeneratorTest.java:LINE_UNDEFINED removeUnusedImports(java.lang.NoClassDefFoundError) com/google/googlejavaformat/java/RemoveUnusedImports (...)
  Resolve these lints or suppress with `suppressLintsFor`

Contributor Checklist

Jira ticket: [PROJ-IDENT]

@mcculls
mcculls marked this pull request as ready for review October 1, 2026 21:05
@mcculls
mcculls requested a review from a team as a code owner October 1, 2026 21:05
@mcculls
mcculls requested review from bric3 and daniel-mohedano and removed request for a team October 1, 2026 21:05
Comment thread build.gradle.kts Outdated

@bric3 bric3 left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pre-approving.

Have you tried configuring it in the convention ?

val cleanTaskPaths = rootProject.allprojects.map {
  "${it.path.trimEnd(':')}:clean"
}

tasks.withType<com.diffplug.gradle.spotless.SpotlessTask>().configureEach {
  mustRunAfter(cleanTaskPaths)
}

Comment thread build.gradle.kts Outdated
Co-authored-by: Brice Dutheil <brice.dutheil@gmail.com>
@mcculls
mcculls merged commit a63f7c3 into main Oct 2, 2026
6 checks passed
@mcculls
mcculls deleted the mcculls/spotless-noclassdef-fix branch October 2, 2026 14:07
@github-actions github-actions Bot added this to the 0.1.0 milestone Oct 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants