Ved
Ved

Reputation: 3500

Lombok with Maven on Mac

I am using Java 8 on OSX. I have the lombok.jar in classpath and I have the following dependency in maven.

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

When I try to build the code from maven, I get compilation issues :

 mvn clean install
 ...error: cannot find symbol
 [ERROR] symbol:   variable log
 error: cannot find symbol
 [ERROR] symbol:   method getMinLevel()

These are methods/injected dependencies by Lombok not found at the build time. I am not sure what else is required to fix this.

Upvotes: 3

Views: 2033

Answers (2)

Roel Spilker
Roel Spilker

Reputation: 34562

Lombok 1.14.0 is probably the problem. Version 1.14.2 fixes some of the problems, or gives information for better insight. Full Disclosure: I am one of the lombok core developers.

Upvotes: 3

Niels Bech Nielsen
Niels Bech Nielsen

Reputation: 4859

lombok writes code at compile time by inserting it directly in your class file.

You must probably have some @xxx lombok logging annotation set, which apparently compiles to another version of the log library than you have in your maven path.

See the dependencies with mvn dependency:tree or mvn dependency:listto pinpoint your compile version..

I assume you have embedded lombok in your IDE? And it works there, you say? Are you using the same classpath as maven generates (i.e. using a maven plugin for your IDE)?

Upvotes: 0

Related Questions