xorinzor
xorinzor

Reputation: 6477

how to log resulting files from Gradle build task

I'm trying to write a BitBucket Pipeline script for my repository, but so far without much luck, because Gradle seems a pain to debug.

Is there any way to show the resulting files (from compiling the jar for example) in the console when it finishes the : build task?

Preferably I'd like to see as much information as possible, rather too much than too little.

Adding logging.captureStandardOutput LogLevel.DEBUG in my build.gradle file didn't seem to do much, still getting the same output:

:compileJavaNote: -snip-\src\main\java\com\-snip-\atlas\utility\SchematicUtil.java uses or overrides a deprecated API.
Note: Recompile with -Xlint: deprecation for details.

:processResources
:classes
:jar
:assemble
:compileTestJava UP-TO-DATE
:processTestResources UP-TO-DATE
:testClasses UP-TO-DATE
:test UP-TO-DATE
:check UP-TO-DATE
:build

BUILD SUCCESSFUL

Total time: 1.16 secs

Upvotes: 1

Views: 601

Answers (1)

Michael Easter
Michael Easter

Reputation: 24498

Here's one way to do it (e.g. jar for a simple Java project). The build.gradle is:

apply plugin: 'java'

jar { 
    doLast {
        new File("${buildDir}/libs").eachFileRecurse { file ->
            println "TRACER: ${file.getAbsolutePath()}"
        }
    }
}

It should be straight-forward to tailor for other needs.

Upvotes: 2

Related Questions