springdoc / springdoc-openapi-gradle-plugin

Library for OpenAPI 3 with spring-boot
https://springdoc.org
Apache License 2.0
148 stars 47 forks source link

Profile not set #129

Closed ebcFlagman closed 1 year ago

ebcFlagman commented 1 year ago

I've the problem, that the profile is not set when running the application.

Plugin-Configuration

openApi {
    def runProperties = ["--spring.config.additional-location=classpath:/vicard-mock-configuration.yml"]

    apiDocsUrl.set("http://localhost:9090/v3/api-docs")
    outputDir.set(file("$buildDir/documentation"))
    outputFileName.set(openApiSchema)
    waitTimeInSeconds.set(60)

    if (project.hasProperty("CI")) {
        ["--spring.profiles.active=ci-local"].each { runProperties << it }
    }

    customBootRun {
        args = runProperties
    }
}

Console: The following 1 profile is active: "local"

I'm using SpringBoot 3.1.4, Gradle 8.1.1 and the Plugin in version 1.7.0

Any ideas what goes wrong here?

ebcFlagman commented 1 year ago

I think the documentation is not 100% correct.

This configuration now works for me

openApi {
    def runProperties = ["-Dspring.config.additional-location=classpath:/vicard-mock-configuration.yml", "-DstringPassedInForkProperites=true"]

    apiDocsUrl.set("http://localhost:9090/v3/api-docs")
    outputDir.set(file("$buildDir/documentation"))
    outputFileName.set(openApiSchema)
    waitTimeInSeconds.set(60)

    if (project.hasProperty("CI")) {
        ["-Dspring.profiles.active=ci-local"].each { runProperties << it }
    }

    customBootRun {
        jvmArgs.set(runProperties)
    }
}