diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 4d3b945f..f3f05e39 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -36,6 +36,7 @@ jobs:
servers: '[{"id": "serverId", "username": "username", "password": "password"}]'
properties: '[{"prop1": "value1"}, {"prop2": "value2"}]'
mirrors: '[{"id": "mirrorId", "name": "mirrorName", "mirrorOf": "mirrorOf", "url": "mirrorUrl"}]'
+ apacheSnapshots: true
sonatypeSnapshots: true
oracleServers: '[{"id": "oServerId", "username": "oUsername", "password": "oPassword"}]'
oracleRepo: true
diff --git a/README.md b/README.md
index 8fe309f3..8f866ae7 100644
--- a/README.md
+++ b/README.md
@@ -63,6 +63,14 @@ steps:
sonatypeSnapshots: true
```
+Create ```settings.xml``` with https://repository.apache.org/snapshots/ in repository list
+```yml
+steps:
+- uses: s4u/maven-settings-action@v2.1.1
+ with:
+ apacheSnapshots: true
+```
+
Do not override existing ```settings.xml```, from version 2.0 file is override by default :
```yml
steps:
diff --git a/action.yml b/action.yml
index e0903d0c..74935db1 100644
--- a/action.yml
+++ b/action.yml
@@ -19,6 +19,10 @@ inputs:
description: 'add https://oss.sonatype.org/content/repositories/snapshots to repository list - true or false'
default: "false"
required: false
+ apacheSnapshots:
+ description: 'add https://repository.apache.org/snapshots to repository list - true or false'
+ default: "false"
+ required: false
override:
description: 'override existing settings.xml file'
default: "true"
diff --git a/index.test.js b/index.test.js
index 370cf92d..8db92175 100644
--- a/index.test.js
+++ b/index.test.js
@@ -70,6 +70,7 @@ test('run with all feature', () => {
process.env['INPUT_MIRRORS'] = '[{"id": "mirrorId", "name": "mirror Name", "mirrorOf": "mirror Off *", "url": "mirror url"}]';
process.env['INPUT_PROPERTIES'] = '[{"prop1": "value1"}, {"prop2": "value2"}]'
+ process.env['INPUT_APACHESNAPSHOTS'] = true;
process.env['INPUT_SONATYPESNAPSHOTS'] = true;
process.env['INPUT_ORACLEREPO'] = true;
@@ -90,6 +91,36 @@ test('run with all feature', () => {
value1value2
+
+ _apache-snapshots_
+
+ true
+
+
+
+ apache.snapshots.https
+ https://repository.apache.org/snapshots/
+
+ false
+
+
+ true
+
+
+
+
+
+ apache.snapshots.https
+ https://repository.apache.org/snapshots/
+
+ false
+
+
+ true
+
+
+
+
_sonatype-snapshots_
diff --git a/settings.js b/settings.js
index 71f88687..ab731cb7 100644
--- a/settings.js
+++ b/settings.js
@@ -149,6 +149,12 @@ function addProfile(template, profileName) {
profilesXml.appendChild(sonatypeXml);
}
+function addApacheSnapshots(template) {
+ if (isInputTrue('apacheSnapshots')) {
+ addProfile(template, 'apache-snapshot.xml')
+ }
+}
+
function addSonatypeSnapshots(template) {
if (isInputTrue('sonatypeSnapshots')) {
addProfile(template, 'sonatype-snapshot.xml')
@@ -182,6 +188,7 @@ function generate() {
fillServers(settingsXml, 'oracleServers');
fillServerForGithub(settingsXml);
fillProperties(settingsXml);
+ addApacheSnapshots(settingsXml);
addSonatypeSnapshots(settingsXml);
addOracleRepo(settingsXml);
writeSettings(settingsPath, settingsXml);
@@ -211,6 +218,7 @@ module.exports = {
fillServers,
fillServerForGithub,
fillProperties,
+ addApacheSnapshots,
addSonatypeSnapshots,
addOracleRepo,
generate,
diff --git a/settings.test.js b/settings.test.js
index 1c62b026..0a52af0c 100644
--- a/settings.test.js
+++ b/settings.test.js
@@ -319,6 +319,48 @@ test('fillMirrors incorrect fields', () => {
);
});
+test('addApacheSnapshots', () => {
+
+ process.env['INPUT_APACHESNAPSHOTS'] = "true";
+
+ const xml = new DOMParser().parseFromString('');
+
+ settings.addApacheSnapshots(xml);
+
+ const xmlStr = new XMLSerializer().serializeToString(xml);
+ expect(xmlStr).toBe(`
+
+ _apache-snapshots_
+
+ true
+
+
+
+ apache.snapshots.https
+ https://repository.apache.org/snapshots/
+
+ false
+
+
+ true
+
+
+
+
+
+ apache.snapshots.https
+ https://repository.apache.org/snapshots/
+
+ false
+
+
+ true
+
+
+
+`);
+});
+
test('addSonatypeSnapshots', () => {
process.env['INPUT_SONATYPESNAPSHOTS'] = "true";
diff --git a/templates/apache-snapshot.xml b/templates/apache-snapshot.xml
new file mode 100644
index 00000000..182451b5
--- /dev/null
+++ b/templates/apache-snapshot.xml
@@ -0,0 +1,31 @@
+
+
+ _apache-snapshots_
+
+ true
+
+
+
+ apache.snapshots.https
+ https://repository.apache.org/snapshots/
+
+ false
+
+
+ true
+
+
+
+
+
+ apache.snapshots.https
+ https://repository.apache.org/snapshots/
+
+ false
+
+
+ true
+
+
+
+