From 5b936b6d5ceac820a69c2cf2ccb1b0c6a3a8e854 Mon Sep 17 00:00:00 2001 From: khalilou88 Date: Thu, 28 Dec 2023 13:25:22 +0100 Subject: [PATCH] feat(executors): add skipProject option --- packages/nx-maven/src/executors/run-task/executor.ts | 6 +++++- packages/nx-maven/src/executors/run-task/schema.d.ts | 1 + packages/nx-maven/src/executors/run-task/schema.json | 5 +++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/nx-maven/src/executors/run-task/executor.ts b/packages/nx-maven/src/executors/run-task/executor.ts index 8fa9ddb8e..37897627c 100644 --- a/packages/nx-maven/src/executors/run-task/executor.ts +++ b/packages/nx-maven/src/executors/run-task/executor.ts @@ -18,7 +18,11 @@ export default async function runExecutor( task = options.task; } - const command = `${getExecutable()} ${task} -pl :${context.projectName}`; + let command = `${getExecutable()} ${task}`; + + if (!options.skipProject) { + command += ` -pl :${context.projectName}`; + } const mavenRootDirectory = getMavenRootDirectory(); const result = runCommand(command, join(workspaceRoot, mavenRootDirectory)); diff --git a/packages/nx-maven/src/executors/run-task/schema.d.ts b/packages/nx-maven/src/executors/run-task/schema.d.ts index a02edffaf..7b835bd1f 100644 --- a/packages/nx-maven/src/executors/run-task/schema.d.ts +++ b/packages/nx-maven/src/executors/run-task/schema.d.ts @@ -2,4 +2,5 @@ export interface RunTaskExecutorSchema { task: string | string[]; keepItRunning?: boolean; outputDirLocalRepo?: string; + skipProject?: boolean; } diff --git a/packages/nx-maven/src/executors/run-task/schema.json b/packages/nx-maven/src/executors/run-task/schema.json index 9aa0ffc21..7602e6868 100644 --- a/packages/nx-maven/src/executors/run-task/schema.json +++ b/packages/nx-maven/src/executors/run-task/schema.json @@ -26,6 +26,11 @@ "outputDirLocalRepo": { "type": "string", "description": "The artifacts created during the `install phase` will be placed in this sub-directory of the Maven local repository (dynamically calculated)" + }, + "skipProject": { + "type": "boolean", + "description": "Skip specifying a project by generating `-pl :project` part", + "default": false } }, "required": ["task"]