jdaugherty opened a new pull request, #15944:
URL: https://github.com/apache/grails-core/pull/15944
## Description
Fixes #15942.
Grails 8.0.0-M2 users following the documented migration path (create an
app, then swap
`grails-data-hibernate5` → `grails-data-hibernate7` in `build.gradle`) hit
an unresolvable
dependency error:
Conflicting constraints detected: Cannot find a version of
'io.smallrye:jandex' that satisfies the version constraints
The root cause is that a manually-migrated app ends up with **two
conflicting BOMs** on the same
classpath: the default `grails-bom` (generated into
`buildSrc`/`buildscript` regardless of the data
implementation) and `grails-hibernate7-bom` (pulled transitively by
`grails-data-hibernate7`).
`grails-hibernate7-bom` strictly pins `io.smallrye:jandex:3.2.3` while
`hibernate-core` endorses
`hibernate-platform`, which requires jandex `3.3.2` — an irreconcilable
strict-constraint conflict.
Notably, `grails-data-hibernate7` resolves fine when the *matching*
Hibernate 7 BOM variant is the
only Grails BOM in the graph.
Rather than requiring users to hand-edit BOMs, this PR adds first-class
Hibernate 7 support to
Grails Forge so generated apps consume a consistent set of BOMs from the
start:
- **New `gorm-hibernate7` feature** (`GrailsDataHibernate7`) and
`GormImpl.HIBERNATE7`, selectable
via `create-app --data hibernate7` or `--features gorm-hibernate7`.
- **BOM selection matrix** applied consistently to the app dependencies,
the `buildscript`
classpath, and the generated `buildSrc`:
| Data implementation | Without Micronaut | With Micronaut |
|---|---|---|
| Hibernate 5 | `grails-bom` | `grails-micronaut-bom` (enforced) |
| Hibernate 7 | `grails-hibernate7-bom` |
`grails-hibernate7-micronaut-bom` (enforced) |
- **`database-migration`** now emits `grails-data-hibernate7-dbmigration`
for Hibernate 7 apps.
- **Guard rail**: selecting both `gorm-hibernate5` and `gorm-hibernate7`
is rejected with a clear
error (`GrailsDataHibernateValidator`).
- **CLI switch renamed** to `-d, --data` with `-g, --gorm` retained as
legacy aliases.
`GormImpl.HIBERNATE` was migrated to `HIBERNATE5`; the selection values
are now `hibernate5`,
`hibernate7`, `mongodb`, and the legacy value `hibernate` is still
accepted (handled in both the
picocli converter and a new Micronaut `TypeConverter` for the Forge HTTP
API).
- **Naming cleanup in Forge**: feature classes renamed to match their
artifacts
(`GrailsDataHibernate5`, `GrailsDataHibernate7`, `GrailsDataMongoDB`)
and user-facing "GORM"
text updated to "Grails Data" (feature titles/descriptions, CLI help and
error messages, OpenAPI
schema descriptions). Feature names (`gorm-hibernate5`, etc.) are
unchanged for compatibility.
- **Documentation**: `creatingProject.adoc`, the `create-*` command
reference pages, and the sample
help output updated for the new switch, values, and legacy aliases (also
fixes stale
`hibernate, mongodb, neo4j` value lists).
### Testing
- New `GrailsDataHibernate7Spec` (12 tests): dependencies, all four BOM
combinations across
`build.gradle` and `buildSrc`, dbmigration artifact switch,
mutual-exclusion validation, and
datasource config.
- New `GormImplSpec` covering `GormImpl.parse`, including legacy and
unknown values.
- `CreateAppCommandSpec` extended for `--data`, `-d`, legacy
`-g`/`--gorm`, legacy `hibernate`
value, and the updated invalid-value error.
- Full `grails-forge` `check` passes, except
`CreateControllerCommandSpec."test app with controller"`,
which requires a running Docker daemon (Testcontainers) and fails
identically without this change
when Docker is unavailable.
## Contributor Checklist
### Issue and Scope
- [x] This PR is linked to an existing issue that has been **acknowledged or
approved** by the project team. (#15942)
- [x] This PR addresses the **complete scope** of the linked issue.
- [x] This PR contains a **single, focused change**.
- [x] This PR targets the **correct branch** for the type of change.
(`8.0.x` — new Forge feature and CLI switch rename)
### Code Quality
- [x] I have **added or updated tests** that cover the changes introduced in
this PR.
- [ ] I have verified that all existing tests pass by running `./gradlew
build --rerun-tasks`.
<!-- forge core/api/web/cli suites pass; full root rerun not yet
executed -->
- [x] My code follows the project's **code style** guidelines.
- [x] This PR does **not** include mass reformatting, style-only changes, or
large-scale refactoring
unless it was **explicitly approved** in the linked issue. (Forge
feature-class renames were
requested as part of this change.)
- [x] If generative AI tooling was used in preparing this contribution, a
quality model was used to
ensure contributions are **consistent with the project's quality
standards**.
### Licensing and Attribution
- [x] All contributed code is provided under the Apache License 2.0, and new
source files include
the appropriate **Apache license header**.
- [x] I have the necessary rights to submit this contribution and confirm it
is my own original work.
- [x] If generative AI tooling was used in preparing this contribution, I
have followed the ASF
policy on generative tooling and have properly attributed its use.
(Prepared with assistance from Claude Code; reviewed and directed by
the author.)
### Documentation
- [x] If this PR introduces user-facing changes, I have included or updated
the relevant documentation.
- [ ] If this PR adds a new feature, I have updated the **What's New**
section of the Grails Guide.
<!-- not yet done — happy to add before merge -->
- [x] If this PR introduces breaking changes or changes that require user
action during an upgrade,
I have updated the **Upgrade Notes** for the corresponding version in
the Grails Guide.
(No user action required: `-g`, `--gorm`, and the `hibernate` value
remain supported as legacy aliases.)
- [x] The PR description clearly explains **what** was changed and **why**.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]