Skip to content
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

Support Groovy 4 #1374

Closed
lptr opened this issue Sep 30, 2021 · 9 comments · Fixed by #1382
Closed

Support Groovy 4 #1374

lptr opened this issue Sep 30, 2021 · 9 comments · Fixed by #1382

Comments

@lptr
Copy link

lptr commented Sep 30, 2021

Is your feature request related to a problem?

When I tried to use Spock 2.0 with Groovy 4.0.0-beta-1, I got the following error:

> Task :new-app:compileTestGroovy FAILED
startup failed:
Could not instantiate global transform class org.spockframework.compiler.SpockTransform specified at jar:file:/Users/lptr/.gradle/caches/modules-2/files-2.1/org.spockframework/spock-core/2.0-groovy-3.0/705e1eac7070f6ac9dc4fdb64c2c8011d1074482/spock-core-2.0-groovy-3.0.jar!/META-INF/services/org.codehaus.groovy.transform.ASTTransformation  because of exception org.spockframework.util.IncompatibleGroovyVersionException: The Spock compiler plugin cannot execute because Spock 2.0.0-groovy-3.0 is not compatible with Groovy 4.0.0-beta-1. For more information (including enforce mode), see http://docs.spockframework.org (section 'Known Issues').

Describe the solution you'd like

I'd like Spock to support Groovy 4.

Describe alternatives you've considered

I can actually run my tests if I pass -Dspock.iKnowWhatImDoing.disableGroovyVersionCheck=true to both the compiler and the test runner JVMs, but it would be nicer if I didn't have to.

I also need to manually suppress the Groovy dependency used by Spock, as the new one is now under the org.apache.groovy group.

Additional context

Groovy 4.0.0-beta-1 has been released a few weeks ago. It would be nice if Spock supported the latest version.

@szpak
Copy link
Member

szpak commented Oct 1, 2021

There is a plan to add a separate groovy-4.0 Spock in the next stable Groovy release, assuming 4.0-RCx will be ready then.

@lptr
Copy link
Author

lptr commented Oct 1, 2021

That's great, thanks. Do you know when to expect that?

Also, do I understand correctly that there are no known problems with Groovy 4 that'd affect Spock?

@szpak
Copy link
Member

szpak commented Oct 1, 2021

Also, do I understand correctly that there are no known problems with Groovy 4 that'd affect Spock?

I solved the main problem related to running Spock with different Groovy versions by implementing the aforementioned spock.iKnowWhatImDoing.disableGroovyVersionCheck switch (which was very frustrating for Spock 1.3 and Groovy 3). As there was already a discussion on the Groovy mailing list, if beta-1 should be followed by rc-1, I started thinking about a new Spock variant for Groovy 4 (but in the end it is more likely to have beta-2 released first). I plan to start some side work "soon" to check, if there are similar problems as with adjusting Spock to be able to build with both Groovy 2.5 and 3.0 two years ago, however, releasing 2.1-groovy-4.0 (compiled with 4.0.0-beta-1) could be misleading for end users, as there could be some (runtime) incompatibilities between beta-1 and the final version. To avoid that, using the aforementioned flag is currently the recommended approach to Groovy 4.0. Feel free to report (as a separate issue) any problem you will encounter using Spock 2.0-groovy-3.0 and Groovy 4.0(-beta-1).

@szpak szpak added the groovy4 label Oct 1, 2021
@leonard84
Copy link
Member

I've started a PR for this topic #1382

@leonard84 leonard84 linked a pull request Oct 11, 2021 that will close this issue
@lptr
Copy link
Author

lptr commented Jan 31, 2022

Groovy 4 GA is out now. Do you know when we can expect a release of Spock? Thanks!

@nikolay-martynov
Copy link

2.1 is out but seems no Groovy 4 support? Do you plan to add it in 2.2?

@kriegaex
Copy link
Contributor

kriegaex commented Feb 16, 2022

2.1 is out but seems no Groovy 4 support? Do you plan to add it in 2.2?

Yes, that is the plan. See also https://twitter.com/spockframework/status/1493715988440883206.

@leonard84
Copy link
Member

See https://github.com/spockframework/spock/releases/tag/spock-2.2-M1

@nikolay-martynov
Copy link

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants