Skip to content

Commit

Permalink
feat: add mvnw to possible values for NX_MAVEN_CLI env var (#1320)
Browse files Browse the repository at this point in the history
  • Loading branch information
khalilou88 authored Oct 4, 2024
1 parent 5910ba5 commit bfb4acb
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 16 deletions.
2 changes: 1 addition & 1 deletion docs/nx-maven/3-environment-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## NX_MAVEN_CLI

Accept two value mvn and mvnd.
Accept values mvnw, mvn and mvnd.

## NX_MAVEN_CLI_OPTS

Expand Down
12 changes: 0 additions & 12 deletions docs/nx-maven/4-executors.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,3 @@
# Env vars

## NX_MAVEN_CLI_OPTS env var

To pass Arguments to the maven cli in a global mode, you can use the env var NX_MAVEN_CLI_OPTS.

### Usage

```bash
$env:NX_MAVEN_CLI_OPTS='--batch-mode'
```

# Executors

## @jnxplus/nx-maven:run-task
Expand Down
11 changes: 8 additions & 3 deletions packages/nx-maven/src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,17 @@ export function getExecutable() {

const mavenCli = process.env['NX_MAVEN_CLI'];
if (mavenCli) {
if (mavenCli !== 'mvn' && mavenCli !== 'mvnd') {
if (mavenCli !== 'mvnw' && mavenCli !== 'mvn' && mavenCli !== 'mvnd') {
throw new Error(
`Wrong value for NX_MAVEN_CLI. Please choose between mvn and mvnd.`,
`Wrong value for NX_MAVEN_CLI. Please choose between mvnw, mvn and mvnd.`,
);
}
executable = mavenCli;

if (mavenCli === 'mvnw') {
executable = process.platform.startsWith('win') ? 'mvnw.cmd' : './mvnw';
} else {
executable = mavenCli;
}
} else if (process.env['NX_SKIP_MAVEN_WRAPPER'] === 'true') {
//TODO NX_SKIP_MAVEN_WRAPPER is deprecated, please use NX_MAVEN_CLI instead
logger.warn(
Expand Down

0 comments on commit bfb4acb

Please sign in to comment.