Intellij Idea Lombok. @Data etc. are not working

I am trying to use Lombok in my IntelliJ Idea 2016.2.5 Maven project. I have already installed Lombok Plugin for IntelliJ (v. 0.13.16) and added dependency do pom.xml .

However, it is still not working. I have created a sample class to check if Getters and Setters etc. are made , and they are not :( I have tried to add a Maven Lombok Plugin but it also did not work.

I am posting a screenshot from Intellij showing my problem. Everything else is working properly so i don't have any error log etc.

https://i.stack.imgur.com/gqKQW.png

Does anybody know what is the problem?

My plugin configuration :

<plugin>
    <groupId>org.projectlombok</groupId>
    <artifactId>lombok-maven-plugin</artifactId>
    <version>1.16.10.0</version>
    <executions>
      <execution>
        <id>delombok</id>
        <phase>generate-sources</phase>
        <goals>
          <goal>delombok</goal>
        </goals>
        <configuration>
          <addOutputDirectory>false</addOutputDirectory>
          <sourceDirectory>src/main/java</sourceDirectory>
        </configuration>
      </execution>
    </executions>
  </plugin>

After trying to run delombok i go an error

[ERROR] Failed to execute goal org.projectlombok:lombok-maven-plugin:1.16.10.0:testDelombok (default-cli) on project Projekt9: The parameters 'encoding' for goal org.projectlombok:lombok-maven-plugin:1.16.10.0:testDelombok are missing or invalid -> [Help 1]

@Edit

Problem is solved . Just needed to restart IDEA after all stuff :)


My example of lombok-maven-plugin configuration looks like this:

<plugin>
    <groupId>org.projectlombok</groupId>
    <artifactId>lombok-maven-plugin</artifactId>
    <version>1.16.8.0</version>
    <executions>
        <execution>
            <id>delombok</id>
            <phase>generate-sources</phase>
            <goals>
                <goal>delombok</goal>
            </goals>
            <configuration>
                <addOutputDirectory>false</addOutputDirectory>
                <sourceDirectory>src/main/java</sourceDirectory>
            </configuration>
        </execution>
    </executions>
</plugin>

If you are going to use lombok with IDEA don't forget to exclude sources generated by maven ( File -> Project Structure -> Module -> Your Module -> target/generated-sources/delombok mark as Excluded ).


I think you're missing the important annotations: @Getter @Setter

They should be above your class declaration. The plugin makes them visible in your IDE, and (not 100% sure) compiletime the real getters and setters are created.

链接地址: http://www.djcxy.com/p/96588.html

上一篇: 为intellij项目添加lombok插件

下一篇: Intellij Idea Lombok。 @Data等不起作用