Filter .mvn/extensions.xml also for a project without a POM - #759
Open
slawekjaranowski wants to merge 1 commit into
Open
slawekjaranowski wants to merge 1 commit into
slawekjaranowski wants to merge 1 commit into
Conversation
slachiewicz
removed their request for review
September 17, 2026 19:22
slachiewicz
removed their request for review
September 20, 2026 13:43
A project can be denoted either by a path to its pom.xml or merely by a path to its base directory - the latter for a project which has no POM at all. The filtering loop in cloneProjects() assumed the former and derived the project base directory with getParentFile(), which for a POM-less project points at the parent of the project directory. As a result .mvn/extensions.xml of such a project was never interpolated and the @...@ tokens were passed to Maven verbatim. Determine the base directory the same way runBuild() does. The filtering-extensions IT covers a project without a POM now. Its verify script has been converted from BeanShell to Groovy on the way - Groovy assertions report what failed on their own, so the explicit System.out reporting and the try/catch/return true scaffolding are no longer needed. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> # Conflicts: # src/it/filtering-extensions/verify.groovy
slawekjaranowski
force-pushed
the
filter-extensions-for-pom-less-project
branch
from
September 29, 2026 05:37
8aa7779 to
64a8874
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The problem
A project run by the plugin can be denoted either by a path to its
pom.xmlor merely by a path to its base directory - the latter for a project which has no POM at all (scanProjectsDirectory()/collectProjects()keep the bare directory in that case, andrunBuild()then invokes Maven on the directory).The filtering loop in
cloneProjects()assumed the first form only:For a POM-less project
projectPathis the project directory, sogetParentFile()points at its parent - the clone root. The plugin then looks for<cloneProjectsTo>/.mvn/extensions.xmlinstead of<cloneProjectsTo>/<project>/.mvn/extensions.xml, and the project's own.mvn/extensions.xmlis never interpolated: the@...@tokens are passed to Maven verbatim. The failure is silent - no warning, no error.The fix
Determine the base directory the same way
runBuild()does - the project directory itself when the path denotes a directory, its parent otherwise. The now redundantmvnDir.isDirectory()check is dropped (extensionsFile.isFile()already implies it) andpomFileis renamed toprojectFile, since that path is not always a POM - which is what caused the bug in the first place.Tests
The existing
filtering-extensionsIT gains a second test project without apom.xml(only.mvn/extensions.xmlwith@project.*@tokens, plusinvoker.propertieswithinvoker.goals = --versionso Maven can run POM-less). Verified that the IT fails without the production change and passes with it.On the way the IT verify script has been converted from BeanShell to Groovy - Groovy assertions report what failed on their own, so the explicit
System.outreporting and thetry/catch/return truescaffolding are gone (75 lines -> 35).