Netbeans 7.1 + Maven + 0.10.6 compiles but IDE does not recognize getters / setters created using annotations

4,589 views
Skip to first unread message

Itsu Tamam

unread,
Jan 9, 2012, 1:16:47 AM1/9/12
to Project Lombok
When I use getters / setters of another class, created using @Getter
and @Setter, IDE does not recognize the getX() and setX(x) methods
(cannot find symbol). Doing mvn install goes with no problem, though.

Have tried Netbeans 7.1 RC2 on Ubuntu Netbeans 7.1 on Win 7.

This is how dependency is declared in pom.xml:

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

(also tried <scope>compile</scope>)

On Netbeans 7.0.1 same project works as expected (no refactoring, but
other than that lombok performs good).

Reinier Zwitserloot

unread,
Jan 9, 2012, 4:42:56 AM1/9/12
to project...@googlegroups.com
I think scope compile should be enough, for what its worth. This didn't work just in the way you mentioned on netbeans 7.0 if memory serves (an issue where maven-powered projects simply did not run annotation processors in-editor, regardless of the setting), so it's kinda strange this bug seems to have returned in NB 7.1.

Did they perhaps add a 'run annotation processors in editor' option which now needs to be set? Do the getters/setters exist in your own class, i.e. if you write:

public class Foo {
    @Getter int x;

     public int test() {
         return getX();
     }
}

does that work, or does that cause errors?

Fabrizio Giudici

unread,
Jan 9, 2012, 4:47:38 AM1/9/12
to project...@googlegroups.com
I use tons of @Getter / @Setters since a few months, and I didn't see any
problem in various RC for 7.1 and 7.1 final, so far. Have you tried
deleting the cache ($HOME/.netbeans/7.1/var/cache)?


--
Fabrizio Giudici - Java Architect, Project Manager
Tidalwave s.a.s. - "We make Java work. Everywhere."
fabrizio...@tidalwave.it
http://tidalwave.it - http://fabriziogiudici.it

Itsu Tamam

unread,
Jan 10, 2012, 1:25:13 AM1/10/12
to Project Lombok
What help the IDE recognizing Lombok annotated fields as getters and
setters is upgrading maven-compiler-plugin from v 2.0 to 2.3.2.

So:
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.0</version>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
            </plugin>

Is now:
            <plugin>                <groupId>org.apache.maven.plugins</
groupId>                <artifactId>maven-compiler-plugin</
artifactId>                <version>2.3.2</version>               
<configuration>                    <source>1.6</source>               
    <target>1.6</target>                </configuration>            </
plugin>
Not sure what would be the reason for this to fix the issue, but I
tried this on both Windows and Ubuntu, and it worked.
On Jan 9, 11:47 am, "Fabrizio Giudici" <Fabrizio.Giud...@tidalwave.it>
wrote:
> I use tons of @Getter / @Setters since a few months, and I didn't see any
> problem in various RC for 7.1 and 7.1 final, so far. Have you tried
> deleting the cache ($HOME/.netbeans/7.1/var/cache)?
>
> --
> Fabrizio Giudici - Java Architect, Project Manager
> Tidalwave s.a.s. - "We make Java work. Everywhere."
> fabrizio.giud...@tidalwave.ithttp://tidalwave.it-http://fabriziogiudici.it

Fabrizio Giudici

unread,
Jan 10, 2012, 3:21:53 AM1/10/12
to project...@googlegroups.com

I can confirm I use 2.3.2 too.

--
Fabrizio Giudici - Java Architect, Project Manager
Tidalwave s.a.s. - "We make Java work. Everywhere."

Reply all
Reply to author
Forward
0 new messages