Skip to content

Commit 5c30756

Browse files
authored
Merge pull request #30 from Netcentric/feature/clarify-readme
Clarify relation to POM repositories
2 parents 9c68eca + 0935e90 commit 5c30756

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

README.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
# Maven Extension: Repos from System Env
77

8-
This Maven extension allows to add additional remote repositories to the Maven execution by solely using OS level environment variables or Java system properties (without touching `settings.xml` nor `pom.xml`). Furthermore it allows to place certain artifacts directly under `.mvn/repository` (see details [below](#using-file-repositories)).
8+
This Maven extension allows to add additional remote repositories to the Maven execution by solely using OS level environment variables or Java system properties (without touching `settings.xml` nor `pom.xml`). Furthermore it allows to place certain artifacts directly under `.mvn/repository` (see details [below](#using-file-repositories)). This is achieved by modifying the in-memory [Maven settings](https://maven.apache.org/settings.html) before using them.
99

1010
While most of the time setting the remote repositories in the `settings.xml` (and potentially also in `pom.xml`) is the recommended approach, for cases where the `settings.xml` is not under the development team's control it can be useful to configure this extension.
1111

@@ -14,7 +14,7 @@ In case the relevant environment variables are not set this extension has no eff
1414
* Minimise the changes in the regular project setup (only the extension has to be added, all mirrors, repositories from `settings.xml` may remain active for local developers or CI servers)
1515
* Add additional repositories with the help of environment variables or system properties.
1616

17-
This is helpful for constrained build environments (without full control over the `settings.xml` file) and also to enforce a common repository across all developers without additional manual set up.
17+
This is helpful for constrained build environments (without full control over the `settings.xml` file) and also to enforce a common repository across all developers without additional manual set up. As this extension always adds a **new** repository it is mostly useful for cases where no POM repositories are being used. *Just adding credentials for an existing (POM or settings.xml) repository is not supported yet ([issue 28](https://github.com/Netcentric/maven-ext-repos-from-env/issues/28))*.
1818

1919
## Simple Usage
2020

@@ -51,19 +51,21 @@ export MVN_SETTINGS_REPO_USERNAME=username
5151
export MVN_SETTINGS_REPO_PASSWORD=password
5252
```
5353

54+
This leads to using authentication via basic auth to the given repository.
55+
5456
#### Remote https repo without authentication
5557

56-
For the case no authentication is necessary, setting only one env variable is sufficient:
58+
For the case no authentication is necessary, setting only one environment variable is sufficient:
5759

5860
```
5961
export MVN_SETTINGS_REPO_URL=https://repo.myorg.com/path/to/repo_no_auth
6062
```
6163

62-
For this case, no virtual `server` entry is generated for this server.
64+
For this case, no corresponding `server` entry is generated for this repository.
6365

6466
#### Using multiple repositories
6567

66-
It is also possible to use multiple repositories:
68+
It is also possible to use multiple repositories by placing an infix between the environment prefix `MVN_SETTINGS_REPO` and the configuration specific suffix:
6769

6870
```
6971
# REPO_NAME1
@@ -76,7 +78,7 @@ export MVN_SETTINGS_REPO_NAME2_USERNAME=username2
7678
export MVN_SETTINGS_REPO_NAME2_PASSWORD=password2
7779
```
7880

79-
For this case two repositories and two virtual server entries for are created. The order can be important for performance reasons, the repositories are added in natural order of their names (alphabetical).
81+
In this example two repositories and two server entries for are created. The order can be important for performance reasons, the repositories are added in alphabetical order of their names.
8082

8183
#### Using file repositories
8284

@@ -98,13 +100,14 @@ In case the `settings.xml` defines one or multiple mirrors, those are automatica
98100

99101
#### Repository order
100102

101-
By default, the repositories as configured in env are queried **after** the default repositories in settings.xml. For the case that the system env repo is also a proxy repository for Maven Central (i.e. containing all required artifacts), it can be forced to be used first (before the repositories from settings.xml).
103+
By default, the repositories as configured in env are queried **after** the default repositories in `settings.xml`. For the case that the system env repo is also a proxy repository for Maven Central (i.e. containing all required artifacts), it can be forced to be used first (before the repositories from settings.xml).
102104

103105
```
104106
export MVN_SETTINGS_ENV_REPOS_FIRST=true
105107
```
106108

107109
Setting this flag is only relevant for performance reasons, the overall build will work with or without this flag.
110+
For the general order of repositories (both from settings and POM) refer to <https://maven.apache.org/guides/mini/guide-multiple-repositories.html#repository-order>.
108111

109112
#### Distribute configuration with code
110113

0 commit comments

Comments
 (0)