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 test 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="testDelombok", defaultPhase=LifecyclePhase.GENERATE_TEST_SOURCES, requiresDependencyResolution=ResolutionScope.TEST, threadSafe=true) 019public class TestDelombokMojo extends AbstractDelombokMojo { 020 021 /** 022 * Location of the lombok annotated source files. 023 */ 024 @Parameter(property="lombok.testSourceDirectory", defaultValue="${project.basedir}/src/test/lombok", required=true) 025 private File sourceDirectory; 026 027 /** 028 * Location of the generated source files. 029 */ 030 @Parameter(property="lombok.testOutputDirectory", defaultValue="${project.build.directory}/generated-test-sources/delombok", required=true) 031 private File outputDirectory; 032 033 @Override 034 protected String getGoalDescription() { 035 return "Test 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.joinWith(File.pathSeparator, 051 StringUtils.join(this.project.getCompileSourceRoots(), File.pathSeparatorChar), 052 StringUtils.join(this.project.getTestCompileSourceRoots(), File.pathSeparatorChar) 053 ); 054 } 055 056 @Override 057 protected void addSourceRoot(final String path) { 058 project.addTestCompileSourceRoot(path); 059 } 060}