Show output in custom Upload task


(Sebastian Peters) #1

I’ve got the following, custom upload task in my plugin:

project.tasks.create('uploadToSnapshotRepository', Upload.class) {
    description = 'Uploads artifacts to snapshot repository.'
    group = 'Custom'
    dependsOn = ['uploadPrepare']
    
    project.afterEvaluate {
        configuration = project.configurations.archives
        
        repositories.mavenDeployer {
            repository(url: project.snapshotsUrl) {
                authentication(
                    userName: project.nexusUser,
                    password: project.nexusPassword
                )
            }
        }
    }
}

The good news is, this works. Whenever I execute the task, the artifacts get deployed in the snapshot repository of my Nexus just fine. The only problem, I can’t see any output of the actual uploading, which makes it pretty annoying to read, especially when used in a CI environment:

$ gradle uploadToSnapshotRepository
:buildSrc:compileJava UP-TO-DATE
:buildSrc:compileGroovy
:buildSrc:processResources UP-TO-DATE
:buildSrc:classes
:buildSrc:jar
:buildSrc:assemble
:buildSrc:compileTestJava UP-TO-DATE
:buildSrc:compileTestGroovy UP-TO-DATE
:buildSrc:processTestResources UP-TO-DATE
:buildSrc:testClasses UP-TO-DATE
:buildSrc:test UP-TO-DATE
:buildSrc:check UP-TO-DATE
:buildSrc:build
:uploadPrepare
:uploadToSnapshotRepository

BUILD SUCCESSFUL

Total time: 5.002 secs

However, when I enable “-i” I can see the output logs about the uploading process just fine, as if I was using the normal uploadArchives task (which I cannot use here because I’m having multiple upload tasks for different use cases). Is there a way to show that information without having to set the logging flag?


(Sebastian Peters) #2

No idea what could cause this issue or how to bypass it?


(Sebastian Peters) #3

Still looking for a solution. All I really need is a way to enforce the INFO logging level on this specific task, but setting this within the task

logging.level = LogLevel.INFO

doesn’t change anything about its output.


(Sebastian Peters) #4

Still happening… Is this really impossible?