Skip to content

Commit dc20d2d

Browse files
committed
feat: update var names and add missing docs.
Signed-off-by: Chao Wang <chaowan@redhat.com>
1 parent 22a707b commit dc20d2d

3 files changed

Lines changed: 47 additions & 3 deletions

File tree

README.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,9 @@ System.setProperty("EXHORT_PYTHON_PATH", "/path/to/python");
328328
System.setProperty("EXHORT_PIP_PATH", "/path/to/pip");
329329
// Configure proxy for all requests
330330
System.setProperty("EXHORT_PROXY_URL", "http://proxy.example.com:8080");
331+
// Configure Maven settings and repository
332+
System.setProperty("EXHORT_MVN_USER_SETTINGS", "/path/to/custom/settings.xml");
333+
System.setProperty("EXHORT_MVN_LOCAL_REPO", "/path/to/custom/local/repository");
331334
```
332335

333336
> Environment variables takes precedence.
@@ -436,6 +439,47 @@ following keys for setting custom paths for the said executables.
436439

437440
</table>
438441

442+
#### Maven Configuration
443+
444+
You can customize Maven behavior by setting additional environment variables or Java properties:
445+
446+
<table>
447+
<tr>
448+
<th>Configuration</th>
449+
<th>Environment Variable</th>
450+
<th>Description</th>
451+
<th>Default</th>
452+
</tr>
453+
<tr>
454+
<td>Maven User Settings</td>
455+
<td>EXHORT_MVN_USER_SETTINGS</td>
456+
<td>Path to custom Maven settings.xml file</td>
457+
<td><em>Uses Maven's default settings</em></td>
458+
</tr>
459+
<tr>
460+
<td>Maven Local Repository</td>
461+
<td>EXHORT_MVN_LOCAL_REPO</td>
462+
<td>Path to custom Maven local repository directory</td>
463+
<td><em>Uses Maven's default local repository</em></td>
464+
</tr>
465+
</table>
466+
467+
**Examples:**
468+
469+
Using environment variables:
470+
```bash
471+
export EXHORT_MVN_USER_SETTINGS=/home/user/.m2/custom-settings.xml
472+
export EXHORT_MVN_LOCAL_REPO=/home/user/custom-maven-repo
473+
```
474+
475+
Using Java properties:
476+
```java
477+
System.setProperty("EXHORT_MVN_USER_SETTINGS", "/home/user/.m2/custom-settings.xml");
478+
System.setProperty("EXHORT_MVN_LOCAL_REPO", "/home/user/custom-maven-repo");
479+
```
480+
481+
> Environment variables take precedence over Java properties.
482+
439483
#### Match Manifest Versions Feature
440484

441485
##### Background

src/main/java/com/redhat/exhort/providers/JavaMavenProvider.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -343,13 +343,13 @@ private List<String> buildMvnCommandArgs(String... baseArgs) {
343343
List<String> args = new ArrayList<>();
344344
args.add(mvnExecutable);
345345

346-
var userSettingsFile = Operations.getMavenConfig("USER_SETTINGS_FILE");
346+
var userSettingsFile = Operations.getMavenConfig("USER_SETTINGS");
347347
if (userSettingsFile != null) {
348348
args.add("-s");
349349
args.add(userSettingsFile);
350350
}
351351

352-
var localRepository = Operations.getMavenConfig("LOCAL_REPOSITORY");
352+
var localRepository = Operations.getMavenConfig("LOCAL_REPO");
353353
if (localRepository != null) {
354354
args.add("-Dmaven.repo.local=" + localRepository);
355355
}

src/main/java/com/redhat/exhort/tools/Operations.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ public static boolean getWrapperPreference(String name) {
319319
/**
320320
* Retrieves a Maven configuration value from an environment variable.
321321
*
322-
* @param configName the configuration name (e.g., "USER_SETTINGS_FILE", "LOCAL_REPOSITORY")
322+
* @param configName the configuration name (e.g., "USER_SETTINGS", "LOCAL_REPO")
323323
* @return the configuration value if set and not blank, null otherwise
324324
*/
325325
public static String getMavenConfig(String configName) {

0 commit comments

Comments
 (0)