From 696538030dcf6ba670cb1dd8f9d762d860aac01c Mon Sep 17 00:00:00 2001
From: wang--ge <wang__ge@126.com>
Date: Thu, 14 Mar 2024 11:19:28 +0800
Subject: [PATCH] asd

---
 .../org/codehaus/groovy/tools/GrapeMain.groovy   | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/src/main/org/codehaus/groovy/tools/GrapeMain.groovy b/src/main/org/codehaus/groovy/tools/GrapeMain.groovy
index 0a1843d..528e8ed 100644
--- a/src/main/org/codehaus/groovy/tools/GrapeMain.groovy
+++ b/src/main/org/codehaus/groovy/tools/GrapeMain.groovy
@@ -348,10 +348,18 @@ if (cmd.hasOption('v')) {
     return
 }
 
-
-cmd.getOptionValues('D')?.each {String prop ->
-    def (k, v) = prop.split ('=', 2) as List // array multiple assignment quirk
-    System.setProperty(k, v ?: "")
+if (cmd.hasOption('D')) {
+    cmd.getOptionValues('D')?.each {String prop ->
+        while (prop.startsWith("=")) {
+            prop = prop.substring(1, prop.length());
+        }
+        def (k, v) = prop.split ('=', 2) as List // array multiple assignment quirk
+        if (k.isEmpty() || v.isEmpty()) {
+            println "one system property's name or value is emply, skip."
+        } else {
+            System.setProperty(k, v ?: "")
+        }
+    }
 }
 
 String[] arg = cmd.args
-- 
2.33.0

