Skip to content

Sources added by build-helper-maven-plugin are ignored #1019

@machao81

Description

@machao81

Hi,

I need some help with an issue in my project related to having multiple source folders.
I'm using the latest version of the rewrite-maven-plugin, configured like this:

<plugin>
          <groupId>org.openrewrite.maven</groupId>
          <artifactId>rewrite-maven-plugin</artifactId>
          <version>6.15.0</version>
		<configuration>
			<configLocation>./rewrite.yml</configLocation>
			<activeRecipes>
				<recipe>com.sylob.MigrationStruts</recipe>
			</activeRecipes>
		</configuration>
</plugin>

I’ve defined a simple recipe like this:

type: specs.openrewrite.org/v1beta/recipe
name: com.sylob.MigrationStruts
recipeList:
  - org.openrewrite.java.ChangeType:
      oldFullyQualifiedTypeName: org.apache.struts.action.ActionForward
      newFullyQualifiedTypeName: com.sylob.cochisemvc.model.CommandNextStep

My project has three source folders: niveau, socle, and specif, all of which contain Java code that I want to migrate using OpenRewrite.

My pom.xml looks like this:

<build>
    <finalName>Specif_******_Web</finalName>
    <sourceDirectory>specif</sourceDirectory>
[...]
   <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <executions>
          <execution>
            <goals>
              <goal>add-source</goal>
            </goals>
            <phase>generate-sources</phase>
            <configuration>
              <sources>
                <source>socle</source>
                <source>niveau</source>
                <source>specif</source>
              </sources>
            </configuration>
          </execution>
        </executions>
      </plugin>

The build-helper-maven-plugin is used to include multiple source folders instead of relying on the single sourceDirectory.

My issue is: Only the Java files in the sourceDirectory folder are processed by the rewrite-maven-plugin. The files in the other folders added by the build-helper-maven-plugin are ignored. However, Maven compiles all the Java files correctly and generates class files in the target directory.

Could someone explain how to make rewrite-maven-plugin process all source folders added with build-helper-maven-plugin?

Thanks in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions