You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+10-7Lines changed: 10 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@
5
5
6
6
# Maven Extension: Repos from System Env
7
7
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.
9
9
10
10
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.
11
11
@@ -14,7 +14,7 @@ In case the relevant environment variables are not set this extension has no eff
14
14
* 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)
15
15
* Add additional repositories with the help of environment variables or system properties.
16
16
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))*.
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.
63
65
64
66
#### Using multiple repositories
65
67
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:
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.
80
82
81
83
#### Using file repositories
82
84
@@ -98,13 +100,14 @@ In case the `settings.xml` defines one or multiple mirrors, those are automatica
98
100
99
101
#### Repository order
100
102
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).
102
104
103
105
```
104
106
export MVN_SETTINGS_ENV_REPOS_FIRST=true
105
107
```
106
108
107
109
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>.
0 commit comments