Skip to content

Commit

Permalink
Fix detection of Maven versions plugin from parent pom.xml
Browse files Browse the repository at this point in the history
  • Loading branch information
neloydas committed Feb 15, 2025
1 parent 27b93e3 commit 9f0b163
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
3 changes: 2 additions & 1 deletion plugins/maven/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ export default class MavenPlugin implements IPlugin {

/** Detect whether the parent pom.xml has the versions-maven-plugin **/
private static async detectVersionMavenPlugin(): Promise<boolean> {
const pom = await getPom();
await maven.createEffectivePom(pluginOptions, Auto);
const pom = await getPom("target/output.xml");
const pomDom = new jsdom.JSDOM(pom.pomXml, { contentType: "text/xml" })
.window.document;
const versionsMavenPluginNode = pomDom.evaluate(
Expand Down
15 changes: 15 additions & 0 deletions plugins/maven/src/maven.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,18 @@ export async function updatePoms(

await execPromise("git", ["commit", "-am", message, "--no-verify"]);
}

/** Create effective pom file with maven */
export async function createEffectivePom(
options: IMavenPluginOptions,
auto: Auto
) {
auto.logger.verbose.info(
`Creating effective-pom file in target directory`
);

await executeMaven(options, [
"help:effective-pom",
"-Doutput='target/output.xml'"
]);
}

0 comments on commit 9f0b163

Please sign in to comment.