This is an automated email from the ASF dual-hosted git repository.

jdaugherty pushed a commit to branch 7.0.x
in repository https://gitbox.apache.org/repos/asf/grails-core.git


The following commit(s) were added to refs/heads/7.0.x by this push:
     new 44d3bd9569 fix special repos in grails-shell app generation
44d3bd9569 is described below

commit 44d3bd9569f1ad0e6f6f96c17386dc7c052e8f33
Author: James Daugherty <[email protected]>
AuthorDate: Thu Jan 22 00:26:54 2026 -0500

    fix special repos in grails-shell app generation
---
 .../cli/profile/commands/CreateAppCommand.groovy   | 25 +++++++++++++++++-----
 1 file changed, 20 insertions(+), 5 deletions(-)

diff --git 
a/grails-shell-cli/src/main/groovy/org/grails/cli/profile/commands/CreateAppCommand.groovy
 
b/grails-shell-cli/src/main/groovy/org/grails/cli/profile/commands/CreateAppCommand.groovy
index 9172efde5b..d5afc0cb40 100644
--- 
a/grails-shell-cli/src/main/groovy/org/grails/cli/profile/commands/CreateAppCommand.groovy
+++ 
b/grails-shell-cli/src/main/groovy/org/grails/cli/profile/commands/CreateAppCommand.groovy
@@ -811,6 +811,20 @@ class CreateAppCommand extends ArgumentCompletingCommand 
implements ProfileRepos
             if (releaseOnly && snapshotsOnly) {
                 throw new IllegalArgumentException('Repository cannot be both 
releaseOnly and snapshotsOnly')
             }
+
+            if (!url.startsWith('http')) {
+                if (releaseOnly) {
+                    throw new IllegalArgumentException('special repositories 
cannot be releaseOnly')
+                }
+
+                if (snapshotsOnly) {
+                    throw new IllegalArgumentException('special repositories 
cannot be snapshotsOnly')
+                }
+
+                if (includeRestriction) {
+                    throw new IllegalArgumentException('special repositories 
cannot have include restrictions')
+                }
+            }
         }
 
         void includeOnly(String groupRegex, String artifactRegex, String 
versionRegex) {
@@ -824,14 +838,15 @@ class CreateAppCommand extends ArgumentCompletingCommand 
implements ProfileRepos
         String generate(int spaces, String lineSeparator) {
             validate()
 
-            List<String> lines = ["${' ' * spaces}maven {" as String]
-            if (url.startsWith('http')) {
-                lines.add("${' ' * (spaces + 4)}url = '${url}'" as String)
-            } else {
+            if (!url.startsWith('http')) {
                 // mavenLocal(), mavenCentral(), etc
-                lines.add("${' ' * (spaces + 4)}${url}" as String)
+                return "${' ' * (spaces + 4)}${url}" as String
             }
 
+            List<String> lines = [
+                    "${' ' * spaces}maven {" as String,
+                    "${' ' * (spaces + 4)}url = '${url}'" as String
+            ]
             if (includeRestriction) {
                 lines.add(includeRestriction.generate(spaces + 4, 
lineSeparator))
             }

Reply via email to