Drone plugin for generating the settings.xml
with the server authentication for a Maven repository.
Please note that dependencies are saved in the .m2
directory.
The following parameters are used to configure the plugin:
servers[]
: the serversservers[].id
: the server idservers[].username
: the server usernameservers[].password
: the server passwordprofiles[]
: the profilesprofiles[].id
: the profile idprofiles[].repositories[]
: the profile's repositoriesprofiles[].repositories[].id
: the profile's repository idprofiles[].repositories[].name
: the profile's repository nameprofiles[].repositories[].url
: the profile's repository urlprofiles[].repositories[].layout
: the profile's repository layoutprofiles[].plugin_repositories[]
: the profile's plugin repositoriesprofiles[].plugin_repositories[].id
: the profile's plugin repository idprofiles[].plugin_repositories[].name
: the profile's plugin repository nameprofiles[].plugin_repositories[].url
: the profile's plugin repository urlprofiles[].plugin_repositories[].layout
: the profile's plugin repository layoutactive_profiles[]
: the active profilesdebug
: debug mode (optional: set totrue
for verbose messages)
The secrets mode allows for usage of Drone secrets for parameters. For every parameter, the secret prefix to use is maven_
. For example, for storing the servers
parameter as a secret, the key would be maven_servers
. The value for that parameter would still need to be serialised JSON.
pipeline:
build:
image: maven:3-alpine
commands:
- mvn install -gs settings.xml
authenticate:
image: robertstettner/drone-mvn-auth
pull: true
servers:
- id: release
username: ${NEXUS_USERNAME}
password: ${NEXUS_PASSWORD}
- id: snapshot
username: ${NEXUS_USERNAME}
password: ${NEXUS_PASSWORD}
profiles:
- id: my-profile
repositories:
- id: myRepo
name: Repository for my libraries
url: http://maven.my.com
layout: default
plugin_repositories:
- id: myRepo
name: Repository for my libraries
url: http://maven.my.com
layout: default
active_profiles:
- my-profile
deploy:
image: maven:3-alpine
commands:
- mvn clean deploy -gs settings.xml
The example below shows how to use the plugin with secrets.
An example of the servers
parameter value for the secret maven_servers
could be: [{"id": "release","username":"foo","password":"bar"}]
pipeline:
build:
image: maven:3-alpine
commands:
- mvn install -gs settings.xml
authenticate:
image: robertstettner/drone-mvn-auth
pull: true
secrets: [ maven_servers ]
profiles:
- id: my-profile
repositories:
- id: myRepo
name: Repository for my libraries
url: http://maven.my.com
layout: default
plugin_repositories:
- id: myRepo
name: Repository for my libraries
url: http://maven.my.com
layout: default
active_profiles:
- my-profile
deploy:
image: maven:3-alpine
commands:
- mvn clean deploy -gs settings.xml
MIT