grails-gsp icon indicating copy to clipboard operation
grails-gsp copied to clipboard

Gradle - Apache Groovy 4 - Incompatible because this component declares a platform and the consumer needed a library

Open puneetbehl opened this issue 1 year ago • 3 comments

Task List

  • [x] Steps to reproduce provided
  • [x] Stacktrace (if present) provided
  • [ ] Example that reproduces the problem uploaded to Github
  • [x] Full description of the issue provided (see below)

We are trying to update the Apache Groovy dependency to the version v4.0.12. Please checkout to branch upgrade/groovy.

Steps to Reproduce

  1. Update the groovyVersion Gradle property to 4.0.12.
  2. Try to build the project.

Expected Behaviour

The project should be able to resolve the dependencies

Actual Behaviour

The project could not resolve org.apache.groovy:groovy-bom:4.0.12 with following error:


FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':grails-plugin-gsp'.
> Could not resolve all dependencies for configuration ':grails-plugin-gsp:runtimeClasspath'.
   > A problem occurred configuring project ':grails-plugin-sitemesh2'.
      > Could not resolve all files for configuration ':grails-plugin-sitemesh2:runtimeClasspath'.
         > Could not resolve org.apache.groovy:groovy-bom:4.0.12.
           Required by:
               project :grails-plugin-sitemesh2
               project :grails-plugin-sitemesh2 > project :grails-web-sitemesh
               project :grails-plugin-sitemesh2 > project :grails-web-jsp
               project :grails-plugin-sitemesh2 > project :grails-web-jsp > project :grails-web-gsp
               project :grails-plugin-sitemesh2 > project :grails-web-jsp > org.grails:grails-web-common:6.1.2 > project :grails-gsp
               project :grails-plugin-sitemesh2 > project :grails-web-jsp > project :grails-web-gsp > project :grails-web-taglib
               project :grails-plugin-sitemesh2 > project :grails-web-jsp > org.grails:grails-web-common:6.1.2 > project :grails-gsp > project :grails-taglib
            > No matching variant of org.apache.groovy:groovy-bom:4.0.12 was found. The consumer was configured to find a runtime of a library compatible with Java 17, packaged as a jar, preferably optimized for standard JVMs, and its dependencies declared externally but:
                - Variant 'apiElements' capability org.apache.groovy:groovy-bom:4.0.12:
                    - Incompatible because this component declares an API of a platform and the consumer needed a runtime of a library
                    - Other compatible attributes:
                        - Doesn't say anything about how its dependencies are found (required its dependencies declared externally)
                        - Doesn't say anything about its target Java environment (preferred optimized for standard JVMs)
                        - Doesn't say anything about its target Java version (required compatibility with Java 17)
                        - Doesn't say anything about its elements (required them packaged as a jar)
                - Variant 'enforcedApiElements' capability org.apache.groovy:groovy-bom-derived-enforced-platform:4.0.12:
                    - Incompatible because this component declares an API of an enforced platform and the consumer needed a runtime of a library
                    - Other compatible attributes:
                        - Doesn't say anything about how its dependencies are found (required its dependencies declared externally)
                        - Doesn't say anything about its target Java environment (preferred optimized for standard JVMs)
                        - Doesn't say anything about its target Java version (required compatibility with Java 17)
                        - Doesn't say anything about its elements (required them packaged as a jar)
                - Variant 'enforcedRuntimeElements' capability org.apache.groovy:groovy-bom-derived-enforced-platform:4.0.12 declares a runtime of a component:
                    - Incompatible because this component declares an enforced platform and the consumer needed a library
                    - Other compatible attributes:
                        - Doesn't say anything about how its dependencies are found (required its dependencies declared externally)
                        - Doesn't say anything about its target Java environment (preferred optimized for standard JVMs)
                        - Doesn't say anything about its target Java version (required compatibility with Java 17)
                        - Doesn't say anything about its elements (required them packaged as a jar)
                - Variant 'runtimeElements' capability org.apache.groovy:groovy-bom:4.0.12 declares a runtime of a component:
                    - Incompatible because this component declares a platform and the consumer needed a library
                    - Other compatible attributes:
                        - Doesn't say anything about how its dependencies are found (required its dependencies declared externally)
                        - Doesn't say anything about its target Java environment (preferred optimized for standard JVMs)
                        - Doesn't say anything about its target Java version (required compatibility with Java 17)
                        - Doesn't say anything about its elements (required them packaged as a jar)
         > Could not resolve org.codehaus.groovy:groovy-bom:3.0.13.
           Required by:
               project :grails-plugin-sitemesh2 > org.grails:grails-plugin-codecs:6.1.2 > org.grails:grails-encoder:6.1.2 > org.grails:grails-core:6.1.2 > io.micronaut.spring:micronaut-spring-context:4.5.1 > io.micronaut:micronaut-bom:3.10.3
               project :grails-plugin-sitemesh2 > org.grails:grails-plugin-codecs:6.1.2 > org.grails:grails-encoder:6.1.2 > org.grails:grails-core:6.1.2 > io.micronaut.spring:micronaut-spring-context:4.5.1 > io.micronaut:micronaut-bom:3.10.3 > io.micronaut.groovy:micronaut-groovy-bom:3.4.0
            > No matching variant of org.apache.groovy:groovy-bom:4.0.12 was found. The consumer was configured to find a runtime of a library compatible with Java 17, packaged as a jar, preferably optimized for standard JVMs, and its dependencies declared externally but:
                - Variant 'apiElements' capability org.apache.groovy:groovy-bom:4.0.12:
                    - Incompatible because this component declares an API of a platform and the consumer needed a runtime of a library
                    - Other compatible attributes:
                        - Doesn't say anything about how its dependencies are found (required its dependencies declared externally)
                        - Doesn't say anything about its target Java environment (preferred optimized for standard JVMs)
                        - Doesn't say anything about its target Java version (required compatibility with Java 17)
                        - Doesn't say anything about its elements (required them packaged as a jar)
                - Variant 'enforcedApiElements' capability org.apache.groovy:groovy-bom-derived-enforced-platform:4.0.12:
                    - Incompatible because this component declares an API of an enforced platform and the consumer needed a runtime of a library
                    - Other compatible attributes:
                        - Doesn't say anything about how its dependencies are found (required its dependencies declared externally)
                        - Doesn't say anything about its target Java environment (preferred optimized for standard JVMs)
                        - Doesn't say anything about its target Java version (required compatibility with Java 17)
                        - Doesn't say anything about its elements (required them packaged as a jar)
                - Variant 'enforcedRuntimeElements' capability org.apache.groovy:groovy-bom-derived-enforced-platform:4.0.12 declares a runtime of a component:
                    - Incompatible because this component declares an enforced platform and the consumer needed a library
                    - Other compatible attributes:
                        - Doesn't say anything about how its dependencies are found (required its dependencies declared externally)
                        - Doesn't say anything about its target Java environment (preferred optimized for standard JVMs)
                        - Doesn't say anything about its target Java version (required compatibility with Java 17)
                        - Doesn't say anything about its elements (required them packaged as a jar)
                - Variant 'runtimeElements' capability org.apache.groovy:groovy-bom:4.0.12 declares a runtime of a component:
                    - Incompatible because this component declares a platform and the consumer needed a library
                    - Other compatible attributes:
                        - Doesn't say anything about how its dependencies are found (required its dependencies declared externally)
                        - Doesn't say anything about its target Java environment (preferred optimized for standard JVMs)
                        - Doesn't say anything about its target Java version (required compatibility with Java 17)
                        - Doesn't say anything about its elements (required them packaged as a jar)

* Try:
> Run with --info or --debug option to get more log output.

Environment Information

  • Operating System: macIS Sonoma - Version 14.3 Beta
  • Grails Version: 7.0.x
  • JDK Version: Java 17 - zulu

puneetbehl avatar Feb 07 '24 09:02 puneetbehl

@paulk-asert Could you please take a quick look at this?

puneetbehl avatar Feb 07 '24 09:02 puneetbehl

@puneetbehl Could it be that the dependencies have to be upgraded to Groovy 4 first?

matrei avatar Feb 07 '24 16:02 matrei

I somehow suspect you are bumping into this: https://issues.apache.org/jira/browse/GROOVY-10543 Which should be fixed from 4.0.2 (so bumping from 4.0.2 to 4.0.12 should work) but perhaps some earlier version is being brought in somewhere. Groovy 4.0.0/4.0.1 tried to be both a platform and a library but that seemed to break more things than solve things. Are there any references to groovy-all still trying to reference it as platform? I'll try to look further in a couple of days.

paulk-asert avatar Feb 08 '24 07:02 paulk-asert

This is working on https://github.com/grails/grails-gsp/tree/7.0.x

It has come up several times while doing dependency substitution and the workaround was exclude groovy-bom from the substitution

jamesfredley avatar Sep 23 '24 19:09 jamesfredley