diff --git a/plugins/maven/src/index.ts b/plugins/maven/src/index.ts index 2fc129cc8..f877e8be6 100644 --- a/plugins/maven/src/index.ts +++ b/plugins/maven/src/index.ts @@ -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 { - 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( diff --git a/plugins/maven/src/maven.ts b/plugins/maven/src/maven.ts index bd04c9c7d..165de86e2 100644 --- a/plugins/maven/src/maven.ts +++ b/plugins/maven/src/maven.ts @@ -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'" + ]); +}