-
Notifications
You must be signed in to change notification settings - Fork 200
Lombok
Ryan Heaton edited this page Oct 6, 2016
·
3 revisions
It is possible to integrate Enunciate with Project Lombok.
As of Enunciate 2.7, Enunciate provides a lombok-support
module that will natively
handle Lombok annotations. It is an optional module, and will therefore need to
be explicitly included in the Enunciate classpath. Maven users do it like this:
<plugin>
<groupId>com.webcohesion.enunciate</groupId>
<artifactId>enunciate-maven-plugin</artifactId>
<version>${enunciate.version}</version>
<configuration>
...
</configuration>
<executions>
<execution>
<goals>
<goal>assemble</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>com.webcohesion.enunciate</groupId>
<artifactId>enunciate-lombok</artifactId>
<version>${enunciate.version}</version>
</dependency>
</dependencies>
</plugin>
This is done in two steps:
- Configure Lombok to Generate the Sources
- Configure Enunciate to Use the Generated Sources
You may also find the thread at #182 useful.
<plugin>
<groupId>org.projectlombok</groupId>
<artifactId>lombok-maven-plugin</artifactId>
<version>${lombok.version}</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>delombok</goal>
</goals>
</execution>
</executions>
<configuration>
<encoding>utf-8</encoding>
<addOutputDirectory>false</addOutputDirectory>
<sourceDirectory>src/main/java</sourceDirectory>
</configuration>
</plugin>
The Lombok plugin will put the generated sources in ${project.build.directory}/generated-sources/delombok
.
<plugin>
<groupId>com.webcohesion.enunciate</groupId>
<artifactId>enunciate-maven-plugin</artifactId>
<version>${enunciate.version}</version>
<executions>
<execution>
<goals>
<goal>assemble</goal>
</goals>
<configuration>
<sources>
<source>${project.build.directory}/generated-sources/delombok</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>