Skip to content

Commit cf0cc75

Browse files
authored
Merge pull request #14689 from apache/grails-shell-cli-apache-coordinates
Fix profile resolution in grails-shell-cli
2 parents 7c56b38 + e79d6b7 commit cf0cc75

File tree

5 files changed

+18
-14
lines changed

5 files changed

+18
-14
lines changed

grails-profiles/base/profile.yml

+2-4
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,11 @@ skeleton:
1717
executable: ["**/gradlew*", "**/grailsw*"]
1818
binaryExtensions: ['png','gif','jpg','jpeg','ico','icns','pdf','zip','jar','class']
1919
repositories:
20-
- "https://repo1.maven.org/maven2"
21-
- "https://repository.apache.org/content/groups/snapshots"
20+
- "https://repository.apache.org/content/groups/public"
2221
- "https://repo.grails.org/grails/core"
2322
build:
2423
repositories:
25-
- "https://repo1.maven.org/maven2"
26-
- "https://repository.apache.org/content/groups/snapshots"
24+
- "https://repository.apache.org/content/groups/public"
2725
- "https://repo.grails.org/grails/core"
2826
plugins:
2927
- eclipse

grails-profiles/base/skeleton/build.gradle

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
buildscript {
22
repositories {
3-
@buildRepositories@
43
mavenCentral()
4+
@buildRepositories@
5+
56
}
67
dependencies {
78
classpath platform("org.apache.grails:grails-bom:$grailsVersion")

grails-profiles/profile/skeleton/build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ buildscript {
22
repositories {
33
gradlePluginPortal()
44
mavenCentral()
5-
maven { url = 'https://repo1.maven.org/maven2' }
5+
maven { url = 'https://repository.apache.org/content/groups/public' }
66
maven { url = 'https://repo.grails.org/grails/core' }
77
// mavenLocal() // for local testing, do not commit uncommented
88
}
@@ -19,7 +19,7 @@ version = '1.0.0-SNAPSHOT'
1919

2020
repositories {
2121
mavenCentral()
22-
maven { url = 'https://repo1.maven.org/maven2' }
22+
maven { url = 'https://repository.apache.org/content/groups/public' }
2323
maven { url = 'https://repo.grails.org/grails/core' }
2424
// mavenLocal() // for local testing, do not commit uncommented
2525
}

grails-shell-cli/src/main/groovy/org/grails/cli/boot/GrailsDependencyVersions.groovy

+7-3
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,16 @@ class GrailsDependencyVersions implements DependencyManagement {
6666

6767
static GrapeEngine getDefaultEngine() {
6868
def grape = Grape.getInstance()
69-
grape.addResolver([name:"mavenCentral", root:"https://repo1.maven.org/maven2"] as Map<String, Object>)
7069

71-
// Only add snapshot repository when grailsVersion is not set or it ends in SNAPSHOT
70+
// Use apache repository with SNAPSHOTS when grailsVersion is not set or it ends in SNAPSHOT
71+
// otherwise use only mavenCentral
7272
if (!Environment.grailsVersion || Environment.grailsVersion.endsWith("SNAPSHOT")) {
73-
grape.addResolver([name:"apacheSnapshot", root:" https://repository.apache.org/content/groups/snapshots"] as Map<String, Object>)
73+
grape.addResolver([name:"apacheRepository", root:"https://repository.apache.org/content/groups/public"] as Map<String, Object>)
7474
}
75+
else {
76+
grape.addResolver([name:"mavenCentral", root:"https://repo1.maven.org/maven2"] as Map<String, Object>)
77+
}
78+
7579
grape
7680
}
7781

grails-shell-cli/src/main/groovy/org/grails/cli/profile/repository/MavenProfileRepository.groovy

+5-4
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ import org.grails.cli.profile.Profile
4040
@CompileStatic
4141
class MavenProfileRepository extends AbstractJarProfileRepository {
4242

43-
public static final GrailsRepositoryConfiguration DEFAULT_REPO = new GrailsRepositoryConfiguration("mavenCentral", new URI("https://repo1.maven.org/maven2"), true)
44-
public static final GrailsRepositoryConfiguration APACHE_SNAPSHOT = new GrailsRepositoryConfiguration("apacheSnapshot", new URI("https://repository.apache.org/content/groups/snapshots"), true)
43+
public static final GrailsRepositoryConfiguration DEFAULT_REPO = new GrailsRepositoryConfiguration("apacheRepository", new URI("https://repository.apache.org/content/groups/public"), true)
44+
public static final GrailsRepositoryConfiguration MAVEN_CENTRAL = new GrailsRepositoryConfiguration("mavenCentral", new URI("https://repo1.maven.org/maven2"), false)
4545

4646
List<GrailsRepositoryConfiguration> repositoryConfigurations
4747
MavenResolverGrapeEngine grapeEngine
@@ -60,8 +60,9 @@ class MavenProfileRepository extends AbstractJarProfileRepository {
6060
}
6161

6262
MavenProfileRepository() {
63-
// Only add snapshot repository when grailsVersion is not set or it ends in SNAPSHOT
64-
this((!Environment.grailsVersion || Environment.grailsVersion.endsWith("SNAPSHOT")) ? [DEFAULT_REPO, APACHE_SNAPSHOT] : [DEFAULT_REPO])
63+
// Use apache repository with SNAPSHOTS when grailsVersion is not set or it ends in SNAPSHOT
64+
// otherwise use only mavenCentral
65+
this((!Environment.grailsVersion || Environment.grailsVersion.endsWith("SNAPSHOT")) ? [DEFAULT_REPO] : [MAVEN_CENTRAL])
6566
}
6667

6768
@Override

0 commit comments

Comments
 (0)