Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to see the classes generated by lombok in maven spring boot application

I am trying to use lombok in my application which is based on spring boot and maven configuration.

I have added the dependency:

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

in my pom.xml. Also as I am using STS, I have installed Lombok into my sts by running the jar. I am able to use Lombok annotations and use the getters, setters, etc. but I am not able to see my generated classes/methods in target/generated-sources folder.

Is there a particular reason, why I am not able to see those generated classes and how STS or maven is able to use these generated classes/methods?

Can any one help me understand? And if possible how to view those generated classes/methods?

Note: My source code folder is still src/main/java only.

like image 592
happytohelp Avatar asked Oct 30 '25 14:10

happytohelp


2 Answers

Your project compiled class files are located in the target/classes folder. This folder is not visible in the default view i.e., Package Explorer view. You need to enable the Navigator (now deprecated) view from Window -> Show View to see the contents of the target folder. Once done, your compiled classes will be visible in the target/classes folder according to your project package structure.

like image 89
dope Avatar answered Nov 01 '25 04:11

dope


Lombok doesn't work by outputting source into target/generated-sources; that technique only allows adding new source files, not modifying the classes being compiled. Lombok instead works by hacking into the compiler internals and messing with the compilation process itself.

like image 21
chrylis -cautiouslyoptimistic- Avatar answered Nov 01 '25 05:11

chrylis -cautiouslyoptimistic-



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!