question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Could not read entry ':spotlessJava' from cache taskArtifacts.bin > com.diffplug.spotless.extra.GitAttributesLineEndings$Policy

See original GitHub issue
12:16 $ gradle spotlessjava
:spotlessJava

FAILURE: Build failed with an exception.

* What went wrong:
Could not read entry ':spotlessJava' from cache taskArtifacts.bin (/home/arul/workspace/.gradle/3.1/taskArtifacts/taskArtifacts.bin).
> com.diffplug.spotless.extra.GitAttributesLineEndings$Policy

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 6.114 secs

I am getting above error everytime I ran gradle spotlessjava . If I removed .gradle folder in project directory then its successfully build.

This is my spotless configurations

buildscript {
  repositories.maven { url 'https://plugins.gradle.org/m2/' }
  dependencies.classpath 'com.diffplug.spotless:spotless-plugin-gradle:3.0.0'
}

apply plugin: com.diffplug.gradle.spotless.SpotlessPlugin

spotless {
  java {
    googleJavaFormat('1.1')
    custom 'Lambda fix', { it.replace('} )', '})').replace('} ,', '},') }
    importOrder(['java', 'javax', 'org', 'com'])
    trimTrailingWhitespace()
  }
  format 'misc', {
    target '**/.gitignore', '**/*.gradle', '**/*.md', '**/*.sh'
    indentWithSpaces(2)
    trimTrailingWhitespace()
    endWithNewline()
  }
}

Gradle version

12:27 $ gradle --version

------------------------------------------------------------
Gradle 3.1
------------------------------------------------------------

Build time:   2016-09-19 10:53:53 UTC
Revision:     13f38ba699afd86d7cdc4ed8fd7dd3960c0b1f97

Groovy:       2.4.7
Ant:          Apache Ant(TM) version 1.9.6 compiled on June 29 2015
JVM:          1.8.0_101 (Oracle Corporation 25.101-b13)
OS:           Linux 4.4.0-57-generic amd64

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
arulrajnetcommented, Apr 25, 2017

This bug is fixed in gradle 3.5. I have cross verified the same.

0reactions
nedtwiggcommented, Feb 27, 2017

Did some more digging. My suggestion to “replace **/* with *” was a bad tip. It does improve performance, but it is not helpful in solving this bug.

Looking at the issue you referenced, gradle/gradle#784, I’m pretty sure that is the problem. It looks like they’re in the home run of shipping a fix (and speed improvement!) with gradle/gradle#962.

I think you can workaround this bug by making a spotless subproject which contains just Spotless, so that there aren’t as many competing classes to get mixed up by the Gradle bug.

Until gradle ships a fix, I don’t think there’s anything more we can do from the Spotless side, but we will keep this open until we find a better resolution, either because Gradle ships a fix or we find a way to fix it on the Spotless side.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Could not read entry ... from cache taskArtifacts.bin
After playing around I just deleted my .gradle directory in the project root and Android Studio started working again.
Read more >
Add support for Gradle Configuration Cache #644 - GitHub
Gradle 6.6 introduces the configuration cache. It looks useful, and it would be great to refactor Spotless to support it. I am okay...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found