Why adding more artifacts to a gradle publishing section breaks the main artifact?

29 Views Asked by At

I have a Spring Boot application built using Gradle. I would like to publish it to Nexus so in my build.gradle I added:

[...]

publishing { 
    publications { 
        bootJava(MavenPublication) {
            artifact(bootJar)
        }
    }
}

With this section the publish work as expected.
The jar file that is correctly generated by the springboot gradle plugin contains the folders needed to a springboot webservice:

BOOT-INF
META-INF
org

If I access nexus I can see that everything is correct and everything works fine.

Now I would like to add to the same publication two additional artifacts (the swagger and the client) so I add them to the publishing section like this:

[...]
publishing { 
    publications { 
        bootJava(MavenPublication) {
            artifact(bootJar)
            
            artifact('build/swagger.zip') { 
                classifier 'swagger-api-docs'
            }
            
            artifact(clientJar) { 
                classifier 'client'
            }
        }
    }
}

NOTE: I didn't touch the artifact(bootJar) I only added 2 more with the relative classifiers.

Everything seems to go well, there are no errors on the build and on nexus I correctly see the 3 artifacts as expected.. but the main artifact that before was working is broken this time; if I open it the BOOT-INF folder is missing and the package structure doesn't seem the one related to springboot. What could be the cause? And how could I fix it?

0

There are 0 best solutions below