awhitford / lombok.maven

Maven Plugin for Project Lombok
http://projectlombok.org/
MIT License
110 stars 36 forks source link

support multiple sourceDirectory #182

Open trydofor opened 6 months ago

trydofor commented 6 months ago

support multiple sourceDirectory, somethig like build-helper-maven-plugin do

<sourceDirectory>src1,src2</sourceDirectory>

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>build-helper-maven-plugin</artifactId>
    <version>${build-helper-maven-plugin.version}</version>
    <executions>
        <execution>
            <phase>generate-sources</phase>
            <goals>
                <goal>add-source</goal>
            </goals>
            <configuration>
                <sources>
                    <source>${source.srcMainJava}</source>
                    <source>${source.srcMainJavaGen}</source>
                </sources>
            </configuration>
        </execution>
    </executions>
</plugin>
<plugin>
    <groupId>org.projectlombok</groupId>
    <artifactId>lombok-maven-plugin</artifactId>
    <version>${lombok-maven-plugin.version}</version>
    <configuration>
        <addOutputDirectory>false</addOutputDirectory>
        <sourceDirectory>${source.srcMainJava},${source.srcMainJavaGen}</sourceDirectory>
        <outputDirectory>${source.srcMainDelombok}</outputDirectory>
    </configuration>
    <executions>
        <execution>
            <phase>generate-sources</phase>
            <goals>
                <goal>delombok</goal>
            </goals>
        </execution>
    </executions>
    <dependencies>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>${lombok.version}</version>
        </dependency>
    </dependencies>
</plugin>
trydofor commented 6 months ago

workaround, copy resources to tmp dir

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-resources-plugin</artifactId>
    <executions>
        <execution>
            <id>copy-java-main-lombok</id>
            <phase>generate-sources</phase>
            <goals>
                <goal>copy-resources</goal>
            </goals>
            <configuration>
                <outputDirectory>${source.srcMainLombok}</outputDirectory>
                <resources>
                    <resource>
                        <directory>${source.srcMainJava}</directory>
                    </resource>
                    <resource>
                        <directory>${source.srcMainJavaGen}</directory>
                    </resource>
                </resources>
            </configuration>
        </execution>
    </executions>
</plugin>