Skip to content

Fix profile resolution in grails-shell-cli #14689

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
May 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions grails-profiles/base/profile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,11 @@ skeleton:
executable: ["**/gradlew*", "**/grailsw*"]
binaryExtensions: ['png','gif','jpg','jpeg','ico','icns','pdf','zip','jar','class']
repositories:
- "https://repo1.maven.org/maven2"
- "https://repository.apache.org/content/groups/snapshots"
- "https://repository.apache.org/content/groups/public"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#14706 - issue to adjust this on non SNAPSHOT builds

- "https://repo.grails.org/grails/core"
build:
repositories:
- "https://repo1.maven.org/maven2"
- "https://repository.apache.org/content/groups/snapshots"
- "https://repository.apache.org/content/groups/public"
- "https://repo.grails.org/grails/core"
plugins:
- eclipse
Expand Down
3 changes: 2 additions & 1 deletion grails-profiles/base/skeleton/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
buildscript {
repositories {
@buildRepositories@
mavenCentral()
@buildRepositories@

}
dependencies {
classpath platform("org.apache.grails:grails-bom:$grailsVersion")
Expand Down
4 changes: 2 additions & 2 deletions grails-profiles/profile/skeleton/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ buildscript {
repositories {
gradlePluginPortal()
mavenCentral()
maven { url = 'https://repo1.maven.org/maven2' }
maven { url = 'https://repository.apache.org/content/groups/public' }
maven { url = 'https://repo.grails.org/grails/core' }
// mavenLocal() // for local testing, do not commit uncommented
}
Expand All @@ -19,7 +19,7 @@ version = '1.0.0-SNAPSHOT'

repositories {
mavenCentral()
maven { url = 'https://repo1.maven.org/maven2' }
maven { url = 'https://repository.apache.org/content/groups/public' }
maven { url = 'https://repo.grails.org/grails/core' }
// mavenLocal() // for local testing, do not commit uncommented
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,16 @@ class GrailsDependencyVersions implements DependencyManagement {

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

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

grape
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ import org.grails.cli.profile.Profile
@CompileStatic
class MavenProfileRepository extends AbstractJarProfileRepository {

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

List<GrailsRepositoryConfiguration> repositoryConfigurations
MavenResolverGrapeEngine grapeEngine
Expand All @@ -60,8 +60,9 @@ class MavenProfileRepository extends AbstractJarProfileRepository {
}

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

@Override
Expand Down
Loading