I try to make completion for custom properties in Spring Boot.
I tried to create a simple project via IntelliJ IDEA 2016.3:
In version 2018.3 of IntelliJ, I solved this problem (as per this documentation) in the following way:
With Gradle 4.5 and earlier, the dependency should be declared in the compileOnly configuration, as shown in the following example:
dependencies { compileOnly "org.springframework.boot:spring-boot-configuration-processor" }
With Gradle 4.6 and later, the dependency should be declared in the annotationProcessor configuration, as shown in the following example:
dependencies { annotationProcessor "org.springframework.boot:spring-boot-configuration-processor" }
For Kotlin projects, the working configuration since Gradle 4.6 is using annotation processor
apply plugin: "kotlin-kapt"
dependencies {
kapt("org.springframework.boot:spring-boot-configuration-processor:$springBootVersion")
compileOnly("org.springframework.boot:spring-boot-configuration-processor:$springBootVersion")
}
I had the same problem. I use idea 2017.2 and gradle 4.1, and some blog said you should add:
dependencies {
optional "org.springframework.boot:spring-boot-configuration-processor"
}
But I changed it to this:
dependencies {
compile "org.springframework.boot:spring-boot-configuration-processor"
}
And the warning is gone.
For those who are using maven, Intellij was still not happy with the addition of dependency. Seems like adding annotationProcessorPaths
via maven-compiler-plugin
finally tamed the beast.
Make sure the version
matches your spring dependencies. I suspect it would be already present in your effective POM.
Reason: I was using a custom parent-pom which had a mapstruct annotation processor set in annotationProcessorPaths
and that actually triggered IntelliJ to ask for all other annotation processors to be specified manually as well.
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<annotationProcessorPaths>
<path>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<version>2.0.4.RELEASE</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
</plugins>
</build>
I forgot to add propdeps-plugin. However, I remember that it didn't work for me even with the plugin on 2016.3, So as @CrazyCoder mentioned, try to downgrade Gradle or download the new 2017.1 version (details).
Also you may receive Re-run Spring Boot Configuration Annotation Processor to update generated metadata
when you will solve this issue. For this, click Refresh all Gradle projects
(in Gradle side menu).
According to the Spring Boot docs, the correct configuration for Gradle 4.5 and earlier is
dependencies {
compileOnly group: 'org.springframework.boot', name: 'spring-boot-configuration-processor'
// ...
}