My Spring Boot project is using a gradle-generated application.properties file that is located under the build directory, not in the typical resources directory.
How can I tell Intellij to pull in the generated application.properties file under build/resources/main and ignore the one under src/main/resources? Thanks.

- 51
- 2
- 6
-
If using application.properties file ourside src/main/resources folder then intelij does not recognize it to provide inspection. see https://youtrack.jetbrains.com/issue/IDEA-194635 – David Hofmann Jun 26 '18 at 19:20
1 Answers
I apologize for not giving this answer as a comment but I don't have the required reputation yet to comment.
What you are trying to do is more related to Spring Boot instead of Intellij (adding the Spring Boot tag would help in the future).
This Stack Overflow post may help lead you down the right path.
Essentially you would need to add your build/resources/main/application.properties
file to your classpath. Once on your classpath Spring will be able to see it and read it.
However, that would still leave you with two application.properties
files available to Spring. I am not sure which it would pick, or if it would read both.
You may want to look into using Spring Profiles in order to tell Spring which properties file to read. More information on properties files with profiles can be found on google. I also found this post to be helpful.
If none of that is what you're looking for, another (less ideal and dirty) option would be to move your generated files under your src/main
directory. Then Spring will see it automagically.

- 121
- 4