3

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?

Honza Zidek
  • 9,204
  • 4
  • 72
  • 118
Sidney de Moraes
  • 993
  • 3
  • 11
  • 29

2 Answers2

2

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

Stephane Nicoll
  • 31,977
  • 9
  • 97
  • 89
  • 1
    And why doesn't it work in a Java class inside the same project? I understand that java classes are processed by gradle's task `compileJava` and groovy classes by `compileGroovy`. Am I wrong? – Sidney de Moraes Jan 06 '17 at 15:40
  • It should work with a java class in the same project. I can't tell you why without looking at it. – Stephane Nicoll Jan 06 '17 at 15:51
2

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

Sidney de Moraes
  • 993
  • 3
  • 11
  • 29