Reputation: 440
In my project I'm using the spring-boot-configuration-processor
to generate configuration metadata, which can be helpful at setting fields in @ConfigurationProperties
-marked classes from .properties files.
As a build system I use Gradle.
The configuration looks like this:
@Configuration
@ConfigurationProperties(prefix = "user-config")
public class UserSettings {
/**
* User name.
*/
private String name;
// getters & setters
}
And I import spring-boot-configuration-processor
dependency in Gradle like this:
annotationProcessor group: 'org.springframework.boot', name: 'spring-boot-configuration-processor'
The problem is that IntelliJ IDEA can't find the generated spring-configuration-metadata.json
file, which lies in /build/classes/java/main/META-INF
.
I did some research and found out that IDEA uses out/production/classes
path for production output, while Gradle uses build/classes/java/main
.
Then I came to this SO question, where I found a solution: https://stackoverflow.com/a/55516113/8521177. As pointed there, there are two solutions:
spring-configuration-metadata.json
metadata file.And another solution is to put generated file in src/main/resources/META-INF
manually and deploy the app with the file in this folder.
The second solution worked out, but then in the same answer I found this comment - Intellij - set default output path to gradle output, which states that gradle idea
is obsolete and one should use the 'delegate' option in IDEA. I turned this option on, and now IDEA produces output in the same folder as Gradle does, but once again IDEA can't find the generated metadata file, since output path is set to out/ again.
So, what's the proper solution to make IDEA recognize this generated file?
UPD: I use IntelliJ IDEA 2019.1.3 (Ultimate Edition), Gradle 5.4.1, Spring Boot 2.1.5.
Upvotes: 1
Views: 1151