springdoc-openapi-gradle-plugin icon indicating copy to clipboard operation
springdoc-openapi-gradle-plugin copied to clipboard

Application run failed: IllegalStateException - No Docker Compose file found

Open MMANZANERO opened this issue 1 year ago • 2 comments

The application fails to run after updating to version 1.9.0 of the org.springdoc.openapi-gradle-plugin. The error indicates that no Docker Compose file is found in the specified directory.

Error Log

2024-07-02T09:58:32.472Z ERROR 2938 --- [           main] o.s.boot.SpringApplication               : Application run failed

java.lang.IllegalStateException: No Docker Compose file found in directory '/home/runner/work/app/build/tmp/forkedSpringBootRun/.'

Previous Configuration (version 1.8.0):

openApi {
    groupedApiMappings.set([
            "http://localhost:8080/v3/api-docs.yaml/event1" : "event1.yaml",
            "http://localhost:8080/v3/api-docs.yaml/event2"   : "event2.yaml",
    ])
    customBootRun {
        args = ["--spring.profiles.active=local"]
    }
}

Environment:

Plugin version: 1.9.0 Previous working version: 1.8.0 Java version: 21 Gradle version: 8.5

MMANZANERO avatar Jul 08 '24 12:07 MMANZANERO

cause is this change https://github.com/springdoc/springdoc-openapi-gradle-plugin/pull/142

getting the behaviour from before can be achieved by setting the workingDir

for us this did the trick

 customBootRun {
        workingDir.set(project.rootProject.projectDir)
        args.set(["--spring.profiles.active=local"])
    }

for more context: only happens due to some interaction with this dependency developmentOnly "org.springframework.boot:spring-boot-docker-compose"

EAlf91 avatar Jul 18 '24 08:07 EAlf91

This is most likely a problem with compose.yaml not being copied to the build/tmp directory which is now set for forkedSpringBootRun. This is solvable by pointing to the compose.yaml explicitly:

// Kotlin DSL
openApi {
    customBootRun {
        systemProperties = mapOf("spring.docker.compose.file" to "${projectDir}/compose.yaml")
    }
}

anguzo avatar Nov 15 '24 00:11 anguzo