001package lombok.maven; 002 003import java.io.File; 004 005import org.apache.commons.lang3.StringUtils; 006import org.apache.maven.plugins.annotations.LifecyclePhase; 007import org.apache.maven.plugins.annotations.Mojo; 008import org.apache.maven.plugins.annotations.Parameter; 009import org.apache.maven.plugins.annotations.ResolutionScope; 010 011 012/** 013 * Delombok java source with lombok annotations. 014 * 015 * @author <a href="mailto:anthony@whitford.com">Anthony Whitford</a> 016 * @see <a href="http://projectlombok.org/features/delombok.html">Delombok</a> 017 */ 018@Mojo(name="delombok", defaultPhase=LifecyclePhase.GENERATE_SOURCES, requiresDependencyResolution=ResolutionScope.COMPILE, threadSafe=true) 019public class DelombokMojo extends AbstractDelombokMojo { 020 021 /** 022 * Location of the lombok annotated source files. 023 */ 024 @Parameter(property="lombok.sourceDirectory", defaultValue="${project.basedir}/src/main/lombok", required=true) 025 private File sourceDirectory; 026 027 /** 028 * Location of the generated source files. 029 */ 030 @Parameter(property="lombok.outputDirectory", defaultValue="${project.build.directory}/generated-sources/delombok", required=true) 031 private File outputDirectory; 032 033 @Override 034 protected String getGoalDescription() { 035 return "Delombok"; 036 } 037 038 @Override 039 protected File getOutputDirectory() { 040 return outputDirectory; 041 } 042 043 @Override 044 protected File getSourceDirectory() { 045 return sourceDirectory; 046 } 047 048 @Override 049 protected String getSourcePath() { 050 return StringUtils.join(this.project.getCompileSourceRoots(), File.pathSeparatorChar); 051 } 052 053 @Override 054 protected void addSourceRoot(final String path) { 055 project.addCompileSourceRoot(path); 056 } 057}