user3787773
user3787773

Reputation: 31

Netbeans,maven project lombok - cannot find symbol

I use Netbeans 8, java 1.7. I imported maven project. This project contains lombok.jar

In class view i have many errors , cimple errors. I can not find enable annotation processors for imported maven projec. Project -> properties ->Build-> compile does not contains it.

I have no ide how fix it. Can you help me ?

Upvotes: 3

Views: 1944

Answers (4)

Daniel Wieth
Daniel Wieth

Reputation: 59

Found a solution using a Maven plugin:

<build>
  <plugins>
    <plugin>
      <groupId>org.projectlombok</groupId>
      <artifactId>lombok-maven-plugin</artifactId>
      <version>1.16.8.0</version>
      <executions>
        <execution>
          <phase>generate-sources</phase>
          <goals>
            <goal>delombok</goal>
          </goals>
        </execution>
      </executions>
    </plugin>
  </plugins>
</build>

Basically the code gets "delomboked", meaning classes are generated and put into the "generated-sources"-folder. The plugin runs every time the code is rebuilt.

For further explanation, see https://www.illucit.com/blog/2016/03/lombok-1-16-with-netbeans-8-1-maven/

Upvotes: -3

pushStack
pushStack

Reputation: 4313

You have to switch to a previous version of lombook (1.14.8 works fine) :

    <dependency> 
        <groupId>org.projectlombok</groupId> 
        <artifactId>lombok</artifactId> 
        <version>1.14.8</version> 
        <scope>provided</scope> 
    </dependency>

I had this issue when I changed my java version from 1.7 to 1.8.

Upvotes: 5

Jaumzera
Jaumzera

Reputation: 2369

I was getting the same error using Netbeans 8.0.2, OpenJDK 1.7 and Lombok 1.16.+. I changed Lombok version to 1.14.8 and it worked perfectly.

Upvotes: 1

Nebojsa Arezina
Nebojsa Arezina

Reputation: 34

For me, it started working after I changed Java Platform option in NetBeans from 1.7 to 1.6 (Right click on project -> Properties -> Build -> Compile).

I changed it afterwards back from 1.6 to 1.7 and it still worked properly.

Upvotes: 0

Related Questions