Erick, I had the same problem but in a slightly different environment. I think groovy-all-4.0.1 no longer exists, something to do with the move to modules and Java17.
Take the -all out of your gradle build file. Then you must download the Groovy-4.0.1 distribution to get at the lib folder, where all the libraries with their new Java 17 compatible names are stored. You can now point to this library in your build path and it might work. I am in a windows/ Intellij environment so could make use of the msi installer to download the Groovy-4.0.1 system and get the library that way. I just had to make sure Intellij pointed to the download library location. The msi installer locates the Groovy system in a specific location and you just need the lib folder of the download: * C:\Program Files (x86)\Groovy\lib There are other folders in the Groovy folder but I think you only need the lib folder I tried this using Java 8, 11 and 17 and it seemed to work albeit on a not very big program. Hope this helps Jon Emeritus Professor Jon Kerridge BSc MSc PhD FBCS FHEA CITP CEng School of Computing Edinburgh Napier University Merchiston Campus Edinburgh EH10 5DT [email protected]<mailto:[email protected]> ________________________________ From: Nelson, Erick <[email protected]> Sent: 16 March 2022 03:16 To: [email protected] <[email protected]> Subject: Build problem using groovy 4.0.1 CAUTION: This email originated from outside Edinburgh Napier University. Do not follow links or open attachments if you doubt the authenticity of the sender or the content. I’m trying to build a groovy project with Gradle… $ gradle -v ------------------------------------------------------------ Gradle 7.4.1 ------------------------------------------------------------ Build time: 2022-03-09 15:04:47 UTC Revision: 36dc52588e09b4b72f2010bc07599e0ee0434e2e Kotlin: 1.5.31 Groovy: 3.0.9 Ant: Apache Ant(TM) version 1.10.11 compiled on July 10 2021 JVM: 1.8.0_322 (Red Hat, Inc. 25.322-b06) OS: Linux 4.18.0-348.12.2.el8_5.x86_64 amd64 But I get the follow error with trying to build with 4.0.1. Any hints on what I am missing ? I had no problem building with 3.0.9. > Task :compileGroovy FAILED FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':compileGroovy'. > Could not resolve all files for configuration ':compileClasspath'. > Could not resolve org.apache.groovy:groovy-all:4.0.1. Required by: project : > No matching variant of org.apache.groovy:groovy-all:4.0.1 was found. The consumer was configured to find an API of a library compatible with Java 8, preferably not packaged as a jar, preferably optimized for standard JVMs, and its dependencies declared externally but: - Variant 'apiElements' capability org.apache.groovy:groovy-all:4.0.1 declares an API 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 8) - Doesn't say anything about its elements (required them preferably not packaged as a jar) With quite a few more “Variant” issues after this… Erick Nelson Senior Developer HD Supply, Inc. T: 858.740.6523 This message and its attachment(s) are intended for the addressee(s) only and should not be read, copied, disclosed, forwarded or relied upon by any person other than the intended addressee(s) without the permission of the sender. If you are not the intended addressee you must not take any action based on this message and its attachment(s) nor must you copy or show them to anyone. Please respond to the sender and ensure that this message and its attachment(s) are deleted. It is your responsibility to ensure that this message and its attachment(s) are scanned for viruses or other defects. Edinburgh Napier University does not accept liability for any loss or damage which may result from this message or its attachment(s), or for errors or omissions arising after it was sent. Email is not a secure medium. Emails entering Edinburgh Napier University's system are subject to routine monitoring and filtering by Edinburgh Napier University. Edinburgh Napier University is a registered Scottish charity. Registration number SC018373 BSL users can contact us via contactSCOTLAND-BSL, the on-line British Sign Language interpreting service. Find out more on the contactSCOTLAND website.
