This is an automated email from the ASF dual-hosted git repository.
toulmean pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-tuweni.git
The following commit(s) were added to refs/heads/master by this push:
new 31653a3 Read the maven credentials from the local settings file if
present
31653a3 is described below
commit 31653a3d176921985e904e2189cc460bb2f63a8c
Author: Antoine Toulme <[email protected]>
AuthorDate: Sun Apr 21 23:02:15 2019 -0700
Read the maven credentials from the local settings file if present
---
build.gradle | 25 ++++++++++++++++++++-----
1 file changed, 20 insertions(+), 5 deletions(-)
diff --git a/build.gradle b/build.gradle
index af2caa8..dfe1ba8 100644
--- a/build.gradle
+++ b/build.gradle
@@ -281,13 +281,28 @@ allprojects {
publishing {
repositories {
maven {
- credentials {
- username System.getenv('NEXUS_USER')
- password System.getenv('NEXUS_PASSWORD')
- }
+ def isRelease = buildVersion.endsWith('SNAPSHOT')
def releasesRepoUrl =
"https://repository.apache.org/service/local/staging/deploy/maven2"
def snapshotsRepoUrl =
"https://repository.apache.org/content/repositories/snapshots"
- url = buildVersion.endsWith('SNAPSHOT') ? snapshotsRepoUrl :
releasesRepoUrl
+ url = isRelease ? snapshotsRepoUrl : releasesRepoUrl
+
+ def settingsXml = new File(System.getProperty('user.home'),
'.m2/settings.xml')
+ if (settingsXml.exists()) {
+ def serverId = (project.properties['distMgmtServerId'] ?: isRelease
+ ? 'apache.releases.https' : 'apache.snapshots.https')
+ def m2SettingCreds = new
XmlSlurper().parse(settingsXml).servers.server.find { server ->
serverId.equals(server.id.text()) }
+ if (m2SettingCreds) {
+ credentials {
+ username m2SettingCreds.username.text()
+ password m2SettingCreds.password.text()
+ }
+ }
+ } else {
+ credentials {
+ username System.getenv('NEXUS_USER')
+ password System.getenv('NEXUS_PASSWORD')
+ }
+ }
}
}
publications {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]