gradle-git-properties icon indicating copy to clipboard operation
gradle-git-properties copied to clipboard

Intellij + gradle + the plugin don't work correctly

Open rt-works opened this issue 5 years ago • 8 comments

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?

rt-works avatar Jul 05 '19 13:07 rt-works

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 avatar Jul 08 '19 06:07 tha2015

@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?

rt-works avatar Jul 08 '19 06:07 rt-works

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.

tha2015 avatar Jul 08 '19 21:07 tha2015

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

rt-works avatar Jul 09 '19 06:07 rt-works

Adding a example project for reproducing the issue demo.zip

tha2015 avatar Jul 18 '19 16:07 tha2015

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)

tha2015 avatar Aug 01 '19 00:08 tha2015

I suggest adding information about in readme of the project - it took me a while to figure this out.

kkocel avatar Oct 29 '19 13:10 kkocel

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.

mozdynjr avatar Jun 18 '20 20:06 mozdynjr