swagger-gradle-plugin icon indicating copy to clipboard operation
swagger-gradle-plugin copied to clipboard

attachSwaggerArtifact multi-module build not working

Open ribrewguy opened this issue 6 years ago • 3 comments

In a multi module build, where only one module generates a swagger doc, and that module's build.gradle specifies attachSwaggerArtifact = true, I am unable to get the swagger json deployed to artifactory.

Relevant build.gradle:

swagger {
    apiSource {
        attachSwaggerArtifact = true
        outputFormats = ['json']
        springmvc = false
        locations = ['com.foo.resources']
        basePath = '/'
        info {
            title = rootProject.name
            version = rootProject.version
            description = rootProject.description
        }
        swaggerDirectory = "${project.buildDir}/swagger"
        securityDefinition {
            name = 'Bearer'
            type = 'apiKey'
            keyLocation = 'header'
            // The name of the header
            keyName = 'Authorization'
        }
        modelConverters = [
            'io.swagger.validator.BeanValidator',
        ]
    }
}

Please advise.

ribrewguy avatar Jun 29 '18 15:06 ribrewguy

This may be a peculiarity related to artifactory, however, as the Maven builds (using the maven plugin this plugin is based on) seem to ignore the artifact as well. Artifactory says it will publish all artifacts by default (https://www.jfrog.com/confluence/display/RTF/Working+With+Pipeline+Jobs+in+Jenkins#WorkingWithPipelineJobsinJenkins-GradleBuildswithArtifactory). Perhaps this plugin uses a non-standard publication or pulishConfig? Any thoughts on how to resolve this?

ribrewguy avatar Jun 29 '18 17:06 ribrewguy

I'm currently on a long holiday and without a computer, so I'll take a look at it when I'm home.

Currently, I've got a branch with a lot of this changed, so may be already fixed. If not, I can always fix it.

gigaSproule avatar Jul 11 '18 10:07 gigaSproule

To get multiple artifacts created, I have to do some hacking around, so that could also end up being a problem.

gigaSproule avatar Aug 01 '18 20:08 gigaSproule