I am trying to use the Lombok Maven Plugin to ensure the correct creation of Javadocs when using Lombok.
Lombok Maven introduces a new code generation goal, just pri
The delombok goal is designed to transform java code from src/main/lombok to target/generated-source/delombok. Then, the other java code found in src/main/java is combined with target/generated-source/delombok to produce the combined java classes.
It helps to think of delombok as a source code generator.
So how can you get what you really want? (Note that Maven has an addCompileSourceRoot method, but not a corresponding removeCompileSourceRoot.) Imagine the following hack:
from src/main/java to be ${project.build.directory}/generated-sources/delombok.sourceDirectory from src/main/lombok to be src/main/java, and disable addOutputDirectory. Basically, you will use src/main/java, but Maven will ignore it and instead use target/generated-sources/delombok. The Lombok plugin will transform src/main/java into elaborated code in target/generated-sources/delombok.
${project.build.directory}/generated-sources/delombok
org.projectlombok
lombok-maven-plugin
1.16.6.1
delombok
generate-sources
delombok
false
src/main/java
Note that you should not need to hack other plugins, like maven-jar-plugin or maven-javadoc-plugin, because they should respect the sourceDirectory.
Use this hack at your own risk. (My guess is that this may confuse your IDE and some other developers.)