From 385f09c43c8bd0f018c2f873dfd90549caf9b9f3 Mon Sep 17 00:00:00 2001 From: khalilou88 Date: Sat, 6 Jan 2024 15:08:00 +0100 Subject: [PATCH] build: work in progress --- packages/nx-maven/src/utils/index.ts | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/packages/nx-maven/src/utils/index.ts b/packages/nx-maven/src/utils/index.ts index 8214319a0..787dd26a3 100644 --- a/packages/nx-maven/src/utils/index.ts +++ b/packages/nx-maven/src/utils/index.ts @@ -440,7 +440,25 @@ export function getParentProjectValues( ) { let parentProjectRoot = mavenRootDirectory; if (parentProject) { - parentProjectRoot = readProjectConfiguration(tree, parentProject).root; + try { + parentProjectRoot = readProjectConfiguration(tree, parentProject).root; + } catch (err) { + const mavenRootDirAbsolutePath = path.join( + workspaceRoot, + mavenRootDirectory, + ); + + const projectBasedir = execSync( + `${getExecutable()} help:evaluate -Dexpression=project.basedir -q -DforceStdout -pl :${parentProject}`, + { + cwd: mavenRootDirAbsolutePath, + windowsHide: true, + }, + ) + .toString() + .trim(); + parentProjectRoot = path.relative(workspaceRoot, projectBasedir); + } } const parentProjectPomPath = path.join(parentProjectRoot, 'pom.xml');