2019-10-01 22:14:15 +02:00
# maven-settings-action
2020-03-18 18:38:52 +01:00
[](https://github.com/s4u/maven-settings-action/actions?query=workflow%3ATest)
[](https://github.com/s4u/maven-settings-action/actions?query=workflow%3AAudit)
2019-10-01 22:14:15 +02:00
This action setup maven environment for use in action by:
2019-11-25 11:35:57 +01:00
- create maven settings.xml
2019-10-01 22:14:15 +02:00
- set ```interactiveMode` `` to false - useful in CI system
2020-01-24 10:18:40 +01:00
- after job finish generated settings.xml will be removed to prevent cache or left sensitive data on build system
2020-02-22 14:39:48 +01:00
- add server to servers with id=github, username=$GITHUB_ACTOR and password=$GITHUB_TOKEN
2019-10-01 22:14:15 +02:00
2020-02-22 15:36:42 +01:00
# Contributions
- Contributions are welcome!
2020-03-19 20:56:13 +01:00
- Give :star: - if you want to encourage me to work on a project
- Don't hesitate create issue for new feature you dream of or if you suspect some bug
# Project versioning
Project use [Semantic Versioning ](https://semver.org/ ).
We recommended to use the latest and specific release version.
In order to keep your project dependencies up to date you can watch this repository * (Releases only) *
or use automatic tools like [Dependabot ](https://dependabot.com/ ).
2020-02-22 15:36:42 +01:00
2019-10-01 22:14:15 +02:00
# Usage
See [action.yml ](action.yml )
2019-11-25 11:35:57 +01:00
Create default ```settings.xml` ``:
2019-10-01 22:14:15 +02:00
```yml
steps:
2020-10-16 17:07:11 +02:00
- uses: s4u/maven-settings-action@v2 .2.0
2019-10-01 22:14:15 +02:00
```
2020-04-06 22:40:39 +02:00
Create ```settings.xml` `` with servers section:
2019-10-01 22:14:15 +02:00
```yml
steps:
2020-10-16 17:07:11 +02:00
- uses: s4u/maven-settings-action@v2 .2.0
2019-10-01 22:14:15 +02:00
with:
servers: '[{"id": "serverId", "username": "username", "password": "password"}]'
```
2020-04-06 22:40:39 +02:00
Create ```settings.xml` `` with mirrors section:
```yml
steps:
2020-10-16 17:07:11 +02:00
- uses: s4u/maven-settings-action@v2 .2.0
2020-04-06 22:40:39 +02:00
with:
mirrors: '[{"id": "mirrorId", "name": "mirrorName", "mirrorOf": "mirrorOf", "url": "mirrorUrl"}]'
```
2019-10-01 22:14:15 +02:00
Create ```settings.xml` `` with maven properties:
```yml
steps:
2020-10-16 17:07:11 +02:00
- uses: s4u/maven-settings-action@v2 .2.0
2019-10-01 22:14:15 +02:00
with:
properties: '[{"propertyName1": "propertyValue1"}, {"propertyName2": "propertyValue2"}]'
```
2020-12-02 15:54:48 +00:00
It is also possible pass in Github Secrets e.g.
``` yml
with:
servers: |
[{
"id": "sonatype-nexus-snapshots",
"username": "${{ secrets.SONATYPE_USERNAME }}",
"password": "${{ secrets.SONATYPE_PASSWORD }}"
}]
```
**Note**: secrets are * not * passed in if the workflow is triggered from a forked repository. See [here ](https://docs.github.com/en/free-pro-team@latest/actions/reference/encrypted-secrets#using-encrypted-secrets-in-a-workflow ) for further information. This can be avoided by using `if` triggers on the job e.g. `if: github.event_name == 'push'` .
2019-10-01 22:14:15 +02:00
Create ```settings.xml` `` with https://oss.sonatype.org/content/repositories/snapshots in repository list
```yml
steps:
2020-10-16 17:07:11 +02:00
- uses: s4u/maven-settings-action@v2 .2.0
2019-10-01 22:14:15 +02:00
with:
2019-10-01 23:03:44 +02:00
sonatypeSnapshots: true
2019-10-01 22:14:15 +02:00
```
2020-10-16 16:05:58 +02:00
Create ```settings.xml` `` with https://repository.apache.org/snapshots/ in repository list
```yml
steps:
2020-10-16 17:07:11 +02:00
- uses: s4u/maven-settings-action@v2 .2.0
2020-10-16 16:05:58 +02:00
with:
apacheSnapshots: true
```
2020-02-22 14:39:48 +01:00
Do not override existing ```settings.xml` ``, from version 2.0 file is override by default :
2020-01-24 10:18:40 +01:00
```yml
steps:
2020-10-16 17:07:11 +02:00
- uses: s4u/maven-settings-action@v2 .2.0
2020-01-24 10:18:40 +01:00
with:
2020-02-22 14:39:48 +01:00
override: false
2020-01-24 10:18:40 +01:00
```
2020-02-22 14:39:48 +01:00
Do not add github to server in ```settings.xml` ``, by default is added:
```yml
steps:
2020-10-16 17:07:11 +02:00
- uses: s4u/maven-settings-action@v2 .2.0
2020-02-22 14:39:48 +01:00
with:
githubServer: false
```
2020-01-24 10:18:40 +01:00
2020-10-15 23:44:42 +02:00
Create ```settings.xml` `` with special server item configuration for oracle repository [Oracle Maven Repository ](https://docs.oracle.com/middleware/1213/core/MAVEN/config_maven_repo.htm#MAVEN9015 )
```yml
steps:
2020-10-16 17:07:11 +02:00
- uses: s4u/maven-settings-action@v2 .2.0
2020-10-15 23:44:42 +02:00
with:
oracleServers: '[{"id": "serverId", "username": "username", "password": "password"}]'
```
Create ```settings.xml` `` with [Oracle Maven Repository ](https://docs.oracle.com/middleware/1213/core/MAVEN/config_maven_repo.htm#MAVEN9017 )
```yml
steps:
2020-10-16 17:07:11 +02:00
- uses: s4u/maven-settings-action@v2 .2.0
2020-10-15 23:44:42 +02:00
with:
oracleRepo: true
```
2019-10-01 22:14:15 +02:00
# License
The scripts and documentation in this project are released under the [MIT License ](LICENSE )