Skip to content

Commit 5f42ccc

Browse files
authored
docs(maven): minor tweaks and include targetNamePrefix (#34362)
this makes the maven documentation more complete for the latest changes
1 parent 8fdfc52 commit 5f42ccc

1 file changed

Lines changed: 22 additions & 4 deletions

File tree

astro-docs/src/content/docs/technologies/java/maven/introduction.mdoc

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ This plugin requires:
2727
- **Java 17 or newer** - Using older Java versions is unsupported and may lead to issues.
2828
- **Maven 3.6.0 or newer** - Older Maven versions are not supported.
2929

30-
If you need support for an older version, please create an issue on [Github](https://github.com/nrwl/nx)!
30+
If you need support for an older version, please create an issue on [GitHub](https://github.com/nrwl/nx)!
3131
{% /aside %}
3232

3333
## Setup @nx/maven
@@ -97,7 +97,7 @@ The `@nx/maven` plugin automatically detects Maven projects in your workspace by
9797

9898
To view inferred tasks for a project, open the [project details view](/docs/features/explore-graph#explore-projects-in-your-workspace) in Nx Console or run `nx show project my-project` in the command line.
9999

100-
## Setting Up @nx/maven in a Nx Workspace
100+
## Setting Up @nx/maven in an Nx Workspace
101101

102102
In any Nx workspace, you can install `@nx/maven` by running the following command:
103103

@@ -107,13 +107,31 @@ nx add @nx/maven
107107

108108
## @nx/maven Configuration
109109

110-
The `@nx/maven` is configured in the `plugins` array in `nx.json`.
110+
The `@nx/maven` plugin is configured in the `plugins` array in `nx.json`.
111111

112112
```json
113113
// nx.json
114114
{
115-
"plugins": ["@nx/maven"]
115+
"plugins": [
116+
{
117+
"plugin": "@nx/maven",
118+
"options": {
119+
"targetNamePrefix": "mvn-",
120+
"verbose": false
121+
}
122+
}
123+
]
116124
}
117125
```
118126

119127
Once the plugin has been added, `@nx/maven` will automatically retrieve information about projects from Maven and create targets for each phase, goal, and some additional targets for CI.
128+
129+
### Target Name Prefix
130+
131+
In a polyglot workspace supporting projects in different languages, you may have targets with the same name (e.g., `build`, `test`) but different behaviors. By default, Maven phase and goal names are used directly as Nx target names. Use the `targetNamePrefix` option to prefix all Maven targets with a custom string to distinguish them from other targets in your workspace.
132+
133+
For example, with `"targetNamePrefix": "mvn-"`, Nx will create targets with the prefix `mvn-` for your targets as `mvn-compile`, `mvn-test`, `mvn-package`, etc.
134+
135+
### Verbose
136+
137+
Set the `verbose` option to `true` to enable detailed logging from the Maven analyzer. This can be useful for debugging project graph issues. This can also be enabled by setting the `NX_VERBOSE_LOGGING` environment variable.

0 commit comments

Comments
 (0)