gradle-git-properties
gradle-git-properties copied to clipboard
Intellij + gradle + the plugin don't work correctly
As you know IntelliJ in conjunction with Gradle generates built and compiled files into out
directory instead to build like it's done if you use command line Gradle. The problem is, that with using of the plugin the git.properties doesn't get generated into out
and as a consequence, it's impossible to run spring boot application from the IntelliJ b/c of lack of the git.properties.
Any ideas on how to solve it?
Have you tried to configure intellij like this https://stackoverflow.com/questions/54389138/how-to-have-intellij-use-gradle-build-directory-instead-of-out ?
@tha2015 yes, that would work, but this is an extra step for developers to configure in order to start developing a project. I'm just asking why doesn't this plugin work in default IntelliJ way, where out
is default output directory for compiled and assembled things?
As I understand, IntelliJ uses "out/" directory by default (instead of using Gradle "build/" directory). And because the plugin generates git.properties file in "build/" directory, it is not recognized by IntelliJ. (note: I'm not familiar with IntelliJ so I might be wrong)
I don't have a solution for this issue and I wonder how the other plugins which generating resource files will handle this situation.
yes, that's a correct description of the behavior. I also don't know how exactly IntelliJ interprets the build.properties
but for compileJava, compileKotlin plugins it doesn't seem to be a problem to output into out
Adding a example project for reproducing the issue demo.zip
I tried Spring Boot Gradle plugin and it also has a similar issue (build-info.properties is NOT generated in the out/ folder and the URL http://localhost:8080/actuator/info will not show properties when the application is executed from IntelliJ). There is also a question on SO about the issue https://stackoverflow.com/questions/47542270/how-do-i-generate-build-info-properties-in-the-intellij-out-directory-on-debug
Project is attached. demo2.zip
This issue will not be fixed until we have a good solution to support IntelliJ. In the mean time, we will have to workaround by configuring IntelliJ as mentioned (Delegate IDE build/run actions to gradle)
I suggest adding information about in readme of the project - it took me a while to figure this out.
For someone still struggling with this one, this SO answer gave me the idea to solve it in similar way https://stackoverflow.com/a/56023137 For me dummy properties file was far better that changing how Idea handles builds.