Repository: bigtop
Updated Branches:
  refs/heads/master e5480da42 -> d26984f77


BIGTOP-2310: introduce NEXUS_URL for configuring nexus server


Project: http://git-wip-us.apache.org/repos/asf/bigtop/repo
Commit: http://git-wip-us.apache.org/repos/asf/bigtop/commit/d26984f7
Tree: http://git-wip-us.apache.org/repos/asf/bigtop/tree/d26984f7
Diff: http://git-wip-us.apache.org/repos/asf/bigtop/diff/d26984f7

Branch: refs/heads/master
Commit: d26984f7769a0c6493a9bc6c3d6e0f3db72285c9
Parents: e5480da
Author: Olaf Flebbe <[email protected]>
Authored: Sat Apr 30 17:26:54 2016 +0200
Committer: Olaf Flebbe <[email protected]>
Committed: Thu May 12 13:19:52 2016 +0200

----------------------------------------------------------------------
 build.gradle | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/bigtop/blob/d26984f7/build.gradle
----------------------------------------------------------------------
diff --git a/build.gradle b/build.gradle
index 9afeb00..c3d0457 100644
--- a/build.gradle
+++ b/build.gradle
@@ -340,6 +340,9 @@ def artifactToInstall = {
   }
 }
 
+
+def _NEXUS_URL = project.hasProperty("NEXUS_URL") ? NEXUS_URL : 
"http://localhost:8081";
+
 def generate_nexus_tasks = { name, url, snapshot ->
   task "configure-nexus-${name}"(type: Exec) {
     def req = [ data : [ id: name, name: name, repoType: "proxy", repoPolicy : 
snapshot, browseable: true, "indexable": true, "notFoundCacheTTL": 1440,
@@ -350,6 +353,8 @@ def generate_nexus_tasks = { name, url, snapshot ->
                                            "connectionSettings": null]]]
     def root = new groovy.json.JsonBuilder(req)
     def p = root.toString()
+    def _NEXUS_USERPASS = project.hasProperty("NEXUS_USERPASS") ? 
NEXUS_USERPASS : "admin:admin123"
+
     File.createTempFile("temp",".tmp").with {
       deleteOnExit()
 
@@ -357,7 +362,7 @@ def generate_nexus_tasks = { name, url, snapshot ->
 
       workingDir '.'
       commandLine  "curl", "-o", "/dev/null", "-X", "POST", "-d", 
"@$absolutePath",
-        "--header", "Content-Type: application/json", "-u", "admin:admin123", 
"http://localhost:8081/service/local/repositories";
+        "--header", "Content-Type: application/json", "-u", 
"$_NEXUS_USERPASS", "$_NEXUS_URL/service/local/repositories"
     }
   }
 }
@@ -373,12 +378,14 @@ repos.each { r->
 }
 
 task "configure-nexus"(dependsOn: tasks.findAll { alltask -> 
alltask.name.startsWith("configure-nexus-")}*.name,
-      description: "configure all repos") << {
+      description: 'configure build to use a sonatype nexus server.\n' +
+        '  Use -PNEXUS_URL=http://server:8081 to overwrite default server 
http://localhost:8081\n' +
+        '  Use -PNEXUS_USERPASS=user:passwd to overwrite default username 
passwd admin:admin123') << {
    def m2Dir = System.getProperty("user.home") + "/.m2"
    mkdir(m2Dir)
    def writer = new File(m2Dir + "/settings.xml")
    def writeMirrorLine = { name ->
-     
writer.append("<mirror><name>$name</name><url>http://localhost:8081/content/repositories/$name/</url><mirrorOf>$name</mirrorOf></mirror>")
+     
writer.append("<mirror><name>$name</name><url>$_NEXUS_URL/content/repositories/$name/</url><mirrorOf>$name</mirrorOf></mirror>")
    }
    writer.text = "<settings><mirrors>"
    writeMirrorLine( "central")

Reply via email to