Closed doljae closed 4 days ago
The path is resolved against the current working directory. If the working directory is different in the test and non-test cases then the resolved absolute path will also be different. Without knowing how you're running the two different cases, I can't really comment further but, as things stand, I would guess that this is a duplicate of https://github.com/spring-projects/spring-boot/issues/40512 and you need to adjust your IDE's configuration.
Hello @wilkinsona Thanks to your explanation, I realized that the way I was using before was working because of the default settings in the IDE, even though it is not supported by Spring.
I modified my docker-compose.yml
file and related directories to be located inside the module rather than in the root directory and found that it worked fine.
I have one question: what is the difference between the working directory and the application directory? I've been googling but haven't seen a clear answer 🥲
Application directory isn't really defined anywhere which is why we moved away from that term as it's ambiguous and has caused confusion. What we meant was the working directory so that's the term that we now use.
Thanks for your kind explanation @wilkinsona 🙂
Description
Hello. I have noticed that the way I find the
docker-compose.yml
file in a multi-module project is different in normal and test situations.Reproduce
Spring Boot version
Build script
application.yml
Gradle project structure
Result
I put a breakpoint in the DockerComposeFile.of(File file) method and debugged it
file.getAbsolutePath()
PROJECT_ABSOLUTE_PATH/docker/docker-compose.yml
-> works finePROJECT_ABSOLUTE_PATH/spring-mvc/docker/docker-compose.yml
->IllegalArgumentException
withDocker Compose file 'docker/docker-compose.yml' does not exist
Conclusion
When reading the docker compose file location set in
application.yml
in a multi-module project, the path seems to be different when testing and when not testing.