The GitHub Actions job "CI" on 
grails-core.git/fix/profile-version-resolution-7-0-11 has succeeded.
Run started by GitHub user jamesfredley (triggered by jamesfredley).

Head commit for run:
5724164f3d447ce4cd96fe95d125cf50f7fc5edd / James Fredley 
<[email protected]>
Fix profile resolution when GRAILS_REPO_URL points at a BOM-incomplete repo

When the Grails CLI is invoked with GRAILS_REPO_URL pointing at an Apache
staging repository (or any repository whose published BOM does not declare
org.apache.grails.profiles:* coordinates), profile resolution fails with:

  Could not find artifact org.apache.grails.profiles:web:jar: in
  grails-override-repo (https://repository.apache.org/content/groups/staging)

Note the empty version after web:jar:. Two defects combine to produce this:

1. AbstractJarProfileRepository.getProfileArtifact defaults the profile
   version to null and only sets it from grails.profiles user settings, which
   are absent in a clean release-manager test environment. The downstream
   MavenResolverGrapeEngine.createArtifact fallback to a BOM-managed version
   then also returns null because (2).

2. The grails-bom dependencyManagement block does not list any
   org.apache.grails.profiles:* coordinates. Profile subprojects apply the
   org.apache.grails.gradle.grails-profile plugin, which is not in the
   publishedProject filter in grails-bom/base/build.gradle.

Fix:
- Default the profile artifact version to Environment.grailsVersion in
  AbstractJarProfileRepository. Profiles are released in lock-step with
  grails-core since the move to the apache/grails-core monorepo, so the CLI
  version is the correct profile version. User-supplied grails.profiles
  settings still override per profile.
- Include subprojects that apply org.apache.grails.gradle.grails-profile in
  the BOM's publishedProject filter so the published grails-bom and
  grails-base-bom POMs declare profile coordinates in dependencyManagement.
- Add AbstractJarProfileRepositorySpec covering the version-default and
  explicit-GAV paths so this regression cannot recur silently.

Verified locally:
- ./gradlew :grails-shell-cli:test --tests AbstractJarProfileRepositorySpec
  passes both new specs.
- ./gradlew :grails-base-bom:generatePomFileForMavenPublication produces a
  pom-default.xml whose dependencyManagement block now lists
  
org.apache.grails.profiles:{base,plugin,profile,rest-api,rest-api-plugin,web,web-plugin}.
- A separate Gradle-based 7.0.11 staging consumer build (curl from
  start.grails.org/latest.grails.org, grailsVersion=7.0.11, staging repo
  added to build.gradle) resolves all org.apache.grails:* artifacts at
  7.0.11 and ./gradlew assemble succeeds. Only the CLI/wrapper path was
  affected by the bug fixed here.

Assisted-by: claude-code:claude-opus-4

Report URL: https://github.com/apache/grails-core/actions/runs/25172714410

With regards,
GitHub Actions via GitBox

Reply via email to