slawekjaranowski opened a new pull request, #759: URL: https://github.com/apache/maven-invoker-plugin/pull/759
### The problem A project run by the plugin 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 (`scanProjectsDirectory()` / `collectProjects()` keep the bare directory in that case, and `runBuild()` then invokes Maven on the directory). The filtering loop in `cloneProjects()` assumed the first form only: ```java File pomFile = new File(cloneProjectsTo, projectPath); ... File baseDir = pomFile.getParentFile(); File mvnDir = new File(baseDir, ".mvn"); ``` For a POM-less project `projectPath` is the project directory, so `getParentFile()` points at its **parent** - the clone root. The plugin then looks for `<cloneProjectsTo>/.mvn/extensions.xml` instead of `<cloneProjectsTo>/<project>/.mvn/extensions.xml`, and the project's own `.mvn/extensions.xml` is 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 redundant `mvnDir.isDirectory()` check is dropped (`extensionsFile.isFile()` already implies it) and `pomFile` is renamed to `projectFile`, since that path is not always a POM - which is what caused the bug in the first place. ### Tests The existing `filtering-extensions` IT gains a second test project without a `pom.xml` (only `.mvn/extensions.xml` with `@project.*@` tokens, plus `invoker.properties` with `invoker.goals = --version` so 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.out` reporting and the `try/catch/return true` scaffolding are gone (75 lines -> 35). -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
