Skip to content

Commit 43618e6

Browse files
feature: maven.executable.options configuration as list of strings (#1032)
* feature: maven.executable.options configuration as list of strings Closes #981 * fix json format in README fix json format in README --------- Co-authored-by: Jinbo Wang <jinbwan@microsoft.com>
1 parent 80733c9 commit 43618e6

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ The usage of Maven executable is:
137137
You can use `maven.executable.options` to specify default **options** for all your Maven commands executed in current project.
138138
```json
139139
{
140-
"maven.executable.options": "-o -s ./settings.xml" // work offline, and use an alternative settings file
140+
"maven.executable.options": "-o -s ./settings.xml" // work offline and use an alternative settings file. Can also be defined as an array of strings, e.g. ["-o", "-s ./settings.xml"]
141141
}
142142
```
143143
</details>

package.json

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -662,7 +662,17 @@
662662
"scope": "machine"
663663
},
664664
"maven.executable.options": {
665-
"type": "string",
665+
"anyOf": [
666+
{
667+
"type": "string"
668+
},
669+
{
670+
"type": "array",
671+
"items": {
672+
"type": "string"
673+
}
674+
}
675+
],
666676
"default": "",
667677
"description": "%configuration.maven.executable.options%",
668678
"scope": "machine-overridable"
@@ -852,4 +862,4 @@
852862
"which": "^1.3.1",
853863
"xml2js": "^0.5.0"
854864
}
855-
}
865+
}

src/Settings.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,11 @@ export class Settings {
7979
return _getMavenSection("executable.path", resourceOrFilepath);
8080
}
8181
public static options(resourceOrFilepath?: Uri | string): string | undefined {
82-
return _getMavenSection("executable.options", resourceOrFilepath);
82+
const options: string | string[] | undefined = _getMavenSection("executable.options", resourceOrFilepath);
83+
if (Array.isArray(options)) {
84+
return options.join(' ');
85+
}
86+
return options;
8387
}
8488
public static preferMavenWrapper(resourceOrFilepath?: Uri | string): boolean {
8589
return !!_getMavenSection<boolean>("executable.preferMavenWrapper", resourceOrFilepath);

0 commit comments

Comments
 (0)