Failed to build jar

(Eric To) #1

Hello, I am unable to build the jar file for my gradle project, it used to work before…

So if I remove the jar from my build.gradle file and rebuild everything, then gradle would be able to drill in the other dependency projects and build their jars.

:lib-smartcardreader:compileJava UP-TO-DATE
:lib-apdubridge:compileJava UP-TO-DATE
:compileJava UP-TO-DATE
:processResources NO-SOURCE
:classes UP-TO-DATE
:lib-apdubridge:processResources NO-SOURCE
:lib-apdubridge:classes UP-TO-DATE
:lib-apdubridge:jar UP-TO-DATE
:lib-smartcardreader:processResources NO-SOURCE
:lib-smartcardreader:classes UP-TO-DATE
:lib-smartcardreader:jar UP-TO-DATE


Total time: 5.009 secs

However, when I add it back my jar settings, because I want it to package everything up into 1 jar, then it would fail.

So I added this back into my build.gradle file:

jar {
 	from configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
    manifest {
        attributes 'Main-Class': 'OberthurFix'

I do a clean, then jar task, this is what I get:

:processResources NO-SOURCE

FAILURE: Build failed with an exception.

  • What went wrong:
    Failed to capture snapshot of input files for task ‘jar’ property ‘rootSpec$1’ during up-to-date check.

Failed to create MD5 hash for file ‘C:\java\lib-smartcardreader\build\libs\lib-smartcardreader-1.0.jar’.

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


Total time: 8.794 secs