Sidney de Moraes
Sidney de Moraes

Reputation: 1020

"Re-run SpringBoot Configuration Annotation Processor" in project with Groovy, IntelliJ and Gradle

I'm working with IntelliJ 15.0.6, SpringBoot 1.4.3.RELEASE, Gradle 2.14 and Groovy 2.3.11.

I get the following message from IntelliJ:

enter image description here

I tried following from StackOverFlow, the official documentation and JavaCodeGeeks with no success.

This is my configuration file:

@Configuration
@ConfigurationProperties(prefix = "configuracoes")
class GeralConfiguration {
    def proxyEndereco
    def proxyPorta
}

And the relevant part of my application.yaml file:

configuracoes:
    proxyEndereco: http://fake.com
    proxyPorta: 8080

If I remove @ConfigurationProperties from my configuration file, the message disappears.

This is my build.gradle file:

buildscript {
    repositories {
        mavenLocal()
        maven {url('http://repo.spring.io/plugins-release')}
        mavenCentral()
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:1.4.3.RELEASE")
        classpath('org.springframework.build.gradle:propdeps-plugin:0.0.7')
    }
}

apply plugin: 'groovy'
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'
apply plugin: 'propdeps'
apply plugin: 'propdeps-idea'
sourceCompatibility = 1.7

repositories {
    mavenLocal()
    mavenCentral()
}

dependencies {
    compile("org.springframework.boot:spring-boot-starter")
    compile("org.springframework.boot:spring-boot-devtools")
    optional("org.springframework.boot:spring-boot-configuration-processor")
    compile('org.codehaus.groovy:groovy-all:2.3.11')
    compile('com.machinepublishers:jbrowserdriver:0.17.3')
    compile("org.im4java:im4java:1.4.0")

    testCompile("org.springframework.boot:spring-boot-starter-test")
    testCompile("org.spockframework:spock-core:1.1-groovy-2.4-rc-3")
}

compileJava.dependsOn(processResources)
compileGroovy.dependsOn(processResources)

Any ideas on what is going on and how I can fix this?

Upvotes: 3

Views: 7659

Answers (2)

Sidney de Moraes
Sidney de Moraes

Reputation: 1020

@Stephane helped me find the answer.

Indeed annotation processor is not supported with Groovy but I didn't manage to get it to work inside src/main/java as well.

I found out that the classes subfolder inside build was marked as excluded by IntelliJ (I don't know why).

As I tried fixing issues one by one I was never getting success. When I performed all fixes at once and marked the classes subfolder as NOT excluded everything worked fine (although IntelliJ keeps showing me the error message).

Thanks to @Stephane for helping me.

Upvotes: 2

Stephane Nicoll
Stephane Nicoll

Reputation: 33101

Unfortunately, the annotation processor is not supported with Groovy. You may want to report that IJ shouldn't show this warning with Groovy code.

Upvotes: 3

Related Questions