Skip to content

Conversation

@siva-sai-udaygiri
Copy link

Fixes #1057

What was the problem?

On some Maven reactor (multi-module) projects, the migrator could not find the
root build file and failed with:

RootBuildFileNotFoundException: Could not find BuildFile for root module.

This happened when no BuildFile instance was marked as root, for example
when the top-level pom is not directly at the project root path.

What does this change?

  • RootBuildFileFilter

    • Still prefers BuildFile.isRootBuildFile().
    • If no build file is marked as root, it now falls back to the build file
      whose getSourcePath() has the smallest depth (closest to the project root).
  • ApplicationModules

    • getRootModule() uses the same fallback: if no module’s build file is
      marked as root, it selects the module whose build file has the shortest
      source path.
  • Tests

    • Added RootBuildFileFilterTest.choosesBuildFileWithShortestPathAsRootWhenNoneMarkedAsRoot
      to cover the fallback behaviour with parent/pom.xml and
      parent/module/pom.xml.

Testing

  • .\mvnw.cmd -pl components/sbm-core -Dtest=RootBuildFileFilterTest test
  • .\mvnw.cmd -pl applications/spring-boot-upgrade -am package -DskipTests
  • Ran the built spring-boot-upgrade.jar against a local Maven project to
    verify that the RootBuildFileNotFoundException no longer occurs.

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.

will not scan maven reactor

1 participant