From d4de89be1ae64b13e180c81a4bbdaafd7d418763 Mon Sep 17 00:00:00 2001
From: Daniel Stonier <d.stonier@gmail.com>
Date: Sun, 9 Feb 2014 14:37:54 +0900
Subject: [PATCH] set default maven repo if variable is empty and bugfix
 dynamic property warnings.

---
 .../org/ros/gradle_plugins/RosPlugin.groovy   | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/gradle_plugins/src/main/groovy/org/ros/gradle_plugins/RosPlugin.groovy b/gradle_plugins/src/main/groovy/org/ros/gradle_plugins/RosPlugin.groovy
index cd5366e..2024cb5 100644
--- a/gradle_plugins/src/main/groovy/org/ros/gradle_plugins/RosPlugin.groovy
+++ b/gradle_plugins/src/main/groovy/org/ros/gradle_plugins/RosPlugin.groovy
@@ -25,10 +25,13 @@ class RosPlugin implements Plugin<Project> {
             project.apply(plugin: 'maven')
         }
         /* Create project.ros.* property extensions */
-        project.extensions.create("ros", RosPluginExtension)
+        project.extensions.create("ros", RosExtension)
         project.ros.mavenPath = "$System.env.ROS_MAVEN_PATH".split(':')
         project.ros.mavenDeploymentRepository = "$System.env.ROS_MAVEN_DEPLOYMENT_REPOSITORY"
-        project.ros.mavenRepository = "$System.env.ROS_MAVEN_REPOSITORY"
+        def mavenRepository = "$System.env.ROS_MAVEN_REPOSITORY"
+        if ( mavenRepository != 'null' ) {
+            project.ros.mavenRepository = mavenRepository
+        }
         /* 
          * Could use some better handling for when this is not defined as it sets
          * file://null, but it doesn't seem to hurt the process any
@@ -49,7 +52,17 @@ class RosPlugin implements Plugin<Project> {
     }
 }
 
-class RosPluginExtension {
+/* http://www.gradle.org/docs/nightly/dsl/org.gradle.api.plugins.ExtensionAware.html */
+class RosExtension {
     List<String> mavenPath
     String mavenDeploymentRepository
+    String mavenRepository
+    String mavenRepositoryD
+    
+    RosExtension() {
+        /* Initialising the strings here gets rid of the dynamic property deprecated warnings. */
+        this.mavenDeploymentRepository = ""
+        this.mavenRepository = "https://github.com/rosjava/rosjava_mvn_repo/raw/master"
+        this.mavenRepositoryD = "https://github.com/rosjava/rosjava_mvn_repo/raw/master"
+    }
 }
-- 
GitLab