Skip to content

[#103] Delomboking Fails with Multiple Source Folders#157

Open
nils-christian wants to merge 1 commit intoawhitford:masterfrom
nils-christian:#103
Open

[#103] Delomboking Fails with Multiple Source Folders#157
nils-christian wants to merge 1 commit intoawhitford:masterfrom
nils-christian:#103

Conversation

@nils-christian
Copy link
Copy Markdown
Contributor

Signed-off-by: Nils Christian Ehmke nils-christian.ehmke@bmiag.de

Signed-off-by: Nils Christian Ehmke <nils-christian.ehmke@bmiag.de>
@awhitford
Copy link
Copy Markdown
Owner

@nils-christian I don't like that this is a breaking change because it will unnecessarily impact a lot of folks.
Can you please elaborate on why you need this?
Did you consider specifying multiple executions? Something like:

  <build>
    <plugins>
      <plugin>
        <groupId>org.projectlombok</groupId>
        <artifactId>lombok-maven-plugin</artifactId>
        <version>${project.version}</version>
        <executions>
          <execution>
            <id>delombok1</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>delombok</goal>
            </goals>
            <configuration>
              <formatPreferences>
                <javaLangAsFQN>skip</javaLangAsFQN>
              </formatPreferences>
              <sourceDirectory>${project.basedir}/src/main/lombok1</sourceDirectory>
              <verbose>true</verbose>
            </configuration>
          </execution>
          <execution>
            <id>delombok2</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>delombok</goal>
            </goals>
            <configuration>
              <formatPreferences>
                <javaLangAsFQN>skip</javaLangAsFQN>
              </formatPreferences>
              <sourceDirectory>${project.basedir}/src/main/lombok2</sourceDirectory>
              <verbose>true</verbose>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

@awa-xima
Copy link
Copy Markdown

awa-xima commented Jan 30, 2026

For reference, if you keep the property name, i.e. changing

@Parameter(property="lombok.sourceDirectory", defaultValue="${project.basedir}/src/main/lombok", required=true)
    private File sourceDirectory;

instead to

@Parameter(property="lombok.sourceDirectory", defaultValue="${project.basedir}/src/main/lombok", required=true)
    private List<File> sourceDirectory;

then it's not a breaking change. If the pom.xml is

<sourceDirectory>${project.basedir}/src/main/lombok1</sourceDirectory>

Maven still recognizes it as a list with a single entry.

As for why, one use case of multiple source directories is when you have generated code. E.g. src/main/java and target/generated-sources/java. Running it only on one source directory may fail due to compile errors.

Edit: I guess this is already handled by the plugin passing the compile source roots as the --sourcepath option to delombok.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants