0

This is a multimodule SprintBoot 2.0.3 project in IntelliJ 2018.2.5 Community Edition using: Lombok, Spring-Boot-Starter

Logback is working, maven install gives BUILD SUCCESS and spring-boot:run runs the website successfully.

My parent pom.xml has:

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.0.3.RELEASE</version>
    <relativePath/>
</parent>

<modules>
    <module>core</module>
    <module>console</module>
    <module>web</module>
</modules>
<packaging>pom</packaging>

<properties>
    <java.version>10</java.version>
</properties>

core pom has:

<dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
        </dependency>


        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
        </dependency>

And of course spring-boot-starter-logging contains logback-classic.

Despite logging working correctly (console outputs all expected logging messages), Intellij draws red lines on all my classes and causes the distracting "Cannot resolve symbol 'log'" error (perceived error):

enter image description here

I tried adding spring boot's logging depenency manually to my project pom, core pom and web pom but no change in behaviour:

<dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-logging</artifactId>
</dependency>

IntelliJ is definitely set to Java 10:

enter image description here

What is the proper way to get IntelliJ to recognize that logback is handled by SpringBoot?

Yes indeed. The answer was here: https://stackoverflow.com/a/27430992/921587

Specifically: 1. Preferences -> Build, Execution, Deployment -> Compiler -> Annotation Processors -> Check "Enable annotation processing" (In my case this step appears to have been optional. Critical step was STEP 2) 2. Preferences -> Plugins -> Click -> "Browse repositories" -> Search for Lombok -> Install 3. Resart IntelliJ

chrips
  • 4,996
  • 5
  • 24
  • 48
  • 1
    Did you install Intellij plugin for Lombok? Also, you need to add Lombok as a dependency with "provided" scope –  Oct 28 '18 at 13:17
  • @aka-one Yes sir, Lombok dependency is define in core pom (ADDED to question). The scope is not provided because Lombok is now compatible with Java 10 so maven automatically gets a compatible version. – chrips Oct 28 '18 at 14:51
  • I didn't see my solution because I thought I'd already done this. Recently had to blow away my IntelliJ preferences because it crashed on spash screen. – chrips Oct 29 '18 at 02:45

1 Answers1

2

Try to enable Annotation Processing in IntelliJ: https://www.jetbrains.com/help/idea/compiler-annotation-processors.html

Enable annotation processing checkbox is ticked under - Settings | Build | Compiler | Annotation Processors