Problems using maven to compile code with lombok annotations

10,713 views
Skip to first unread message

chooks

unread,
Sep 5, 2013, 2:41:58 PM9/5/13
to project...@googlegroups.com
Hello All,
 
I have a project that uses maven in eclipse (Kepler with maven 3.0.4) that is also using project Lombok.  Everything plays together nicely and inside of the IDE the code builds fine, maven updates all the dependencies just peachily, and all is tranquillo.  However, when I try to build from the command line with maven (3.0.5) I receive errors about being unable to resolve Lombok symbols (e.g.  error: cannot find symbol errors on line with Lombok log statements) Prior to using Lombok, I could use maven from the command line without an issue. 
 
From the Lombok documentation, it seems like maven should Just Work(TM) without having to do anything special.  Being that is seems like there is some problem with annotation processing, I tried to force maven to use the Lombok.core.AnnotationProcessor in the maven-compiler-plugin <configuration>
 
<annotationProcessors>
    <annotationProcessor>lombok.core.AnnotationProcessorr</annotationProcessor>
</annotationProcessors>
 
However maven says it can't find this class.  Is there some setting or parameter to get maven to build with the Lombok annotations? I have looked at the delombok tool, but I don't really care about seeing the generated sources -- I just need the annotations applied at compile time, and my interpretation of the docs is that lombok'd code should be able to compile from maven without issues. 
 
I do have some strong caveats:
1) I am trying to compile under the java 8 early access jdk (jdk1.8.0 b102 and b104) so not sure if that is screwing up the maven annotation discovery process.
2) I am fairly new to maven so might be overlooking something pretty obvious.
 
 
Any insight appreciated. TIA.
 
- chooks
 
 

Lenny Primak

unread,
Sep 5, 2013, 5:25:13 PM9/5/13
to project...@googlegroups.com
All you need to use lombok is have it on the classpath via maven dependency.
For now, it doesn't support Java 8, so that may be your problem.
You don't need to use <annotaionProcessor>

--
You received this message because you are subscribed to the Google Groups "Project Lombok" group.
To unsubscribe from this group and stop receiving emails from it, send an email to project-lombo...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Roel Spilker

unread,
Sep 5, 2013, 5:25:48 PM9/5/13
to project...@googlegroups.com
The java8 bit is most likely the problem. We're working hard to have jdk8 support soon.


--

Roel Spilker

unread,
Sep 5, 2013, 5:26:51 PM9/5/13
to project...@googlegroups.com
Thanks Lenny :-D Your answer is more complete.

Roel Spilker

unread,
Sep 9, 2013, 7:09:45 PM9/9/13
to project...@googlegroups.com
The lombok you can find at http://projectlombok.org/download-edge.html Might Just Work™
To unsubscribe from this group and stop receiving emails from it, send an email to project-lombok+unsubscribe@googlegroups.com.

chooks

unread,
Oct 4, 2013, 6:10:47 PM10/4/13
to project...@googlegroups.com
Adding lombok-edge (version 0.12.1) in place of lombok (0.12.0) fixed the problem.  Sorry for the late response -- didn't see the replies until now...

For those who might find this through google, to add lombok-edge to your local repository is pretty straight foward:

mvn install:install-file -Dfile=lombok-edge.jar -DgroupId=org.projectlombok -DartifactId=lombok-edge -Dversion=0.12.1 -Dpackaging=jar

And then just replace the old lombok dependency with the new group/artifact/version info.

Thanks to all for your help

- chooks
Reply all
Reply to author
Forward
0 new messages