liquibase / liquibase-gradle-plugin

A Gradle plugin for Liquibase
Other
200 stars 60 forks source link

Liquibase gradle plugin 2.1.1 does not work with gradle 7.4.2 #105

Open vinkenfl opened 2 years ago

vinkenfl commented 2 years ago

Hi there, I am unsing the liquibase gradle plugin in version 2.1.1 and gradle with 7.4.2. together with Java 17. By starting for example a "snapshot" task I get the following call stack. Before I was using Java 11 with gradle 6.9.1. and the same plugin version and it worked perfectly.

> Task :liquibase:snapshot
liquibase-plugin: Running the 'generate_local_hibernate' activity...
java.lang.NoClassDefFoundError: Could not initialize class org.codehaus.groovy.vmplugin.v7.Java7
    at org.codehaus.groovy.vmplugin.VMPluginFactory.<clinit>(VMPluginFactory.java:43)
    at org.codehaus.groovy.reflection.GroovyClassValueFactory.<clinit>(GroovyClassValueFactory.java:35)
    at org.codehaus.groovy.reflection.ClassInfo.<clinit>(ClassInfo.java:107)
    at org.codehaus.groovy.reflection.ReflectionCache.getCachedClass(ReflectionCache.java:95)
    at org.codehaus.groovy.reflection.ReflectionCache.<clinit>(ReflectionCache.java:39)
    at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.registerMethods(MetaClassRegistryImpl.java:209)
    at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.<init>(MetaClassRegistryImpl.java:107)
    at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.<init>(MetaClassRegistryImpl.java:85)
    at groovy.lang.GroovySystem.<clinit>(GroovySystem.java:36)
    at org.codehaus.groovy.runtime.InvokerHelper.<clinit>(InvokerHelper.java:86)
    at groovy.lang.GroovyObjectSupport.getDefaultMetaClass(GroovyObjectSupport.java:59)
    at groovy.lang.GroovyObjectSupport.<init>(GroovyObjectSupport.java:32)
    at groovy.lang.Closure.<init>(Closure.java:211)
    at groovy.lang.Closure.<init>(Closure.java:228)
    at groovy.lang.Closure$1.<init>(Closure.java:193)
    at groovy.lang.Closure.<clinit>(Closure.java:193)
    at java.base/java.lang.Class.forName0(Native Method)
    at java.base/java.lang.Class.forName(Class.java:375)
    at picocli.CommandLine$DefaultFactory.loadClosureClass(CommandLine.java:5477)
    at picocli.CommandLine$DefaultFactory.<clinit>(CommandLine.java:5475)
    at picocli.CommandLine.<init>(CommandLine.java:196)
    at picocli.CommandLine$Model$CommandSpec.addSubcommand(CommandLine.java:6405)
    at liquibase.integration.commandline.LiquibaseCommandLine.addSubcommandGroup(LiquibaseCommandLine.java:878)
    at liquibase.integration.commandline.LiquibaseCommandLine.getParentCommandSpec(LiquibaseCommandLine.java:835)
    at liquibase.integration.commandline.LiquibaseCommandLine.addSubcommand(LiquibaseCommandLine.java:788)
    at liquibase.integration.commandline.LiquibaseCommandLine.buildPicoCommandLine(LiquibaseCommandLine.java:199)
    at liquibase.integration.commandline.LiquibaseCommandLine.<init>(LiquibaseCommandLine.java:174)
    at liquibase.integration.commandline.LiquibaseCommandLine.main(LiquibaseCommandLine.java:78)
Exception in thread "main" java.lang.NoClassDefFoundError: Could not initialize class org.codehaus.groovy.reflection.ReflectionCache
    at org.codehaus.groovy.runtime.dgmimpl.NumberNumberMetaMethod.<clinit>(NumberNumberMetaMethod.java:33)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)
    at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
    at java.base/java.lang.reflect.ReflectAccess.newInstance(ReflectAccess.java:128)
    at java.base/jdk.internal.reflect.ReflectionFactory.newInstance(ReflectionFactory.java:347)
    at java.base/java.lang.Class.newInstance(Class.java:645)
    at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.createMetaMethodFromClass(MetaClassRegistryImpl.java:257)
    at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.<init>(MetaClassRegistryImpl.java:110)
    at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.<init>(MetaClassRegistryImpl.java:85)
    at groovy.lang.GroovySystem.<clinit>(GroovySystem.java:36)
    at org.codehaus.groovy.runtime.InvokerHelper.<clinit>(InvokerHelper.java:86)
    at groovy.lang.GroovyObjectSupport.getDefaultMetaClass(GroovyObjectSupport.java:59)
    at groovy.lang.GroovyObjectSupport.<init>(GroovyObjectSupport.java:32)
    at groovy.lang.Closure.<init>(Closure.java:211)
    at groovy.lang.Closure.<init>(Closure.java:228)
    at groovy.lang.Closure$1.<init>(Closure.java:193)
    at groovy.lang.Closure.<clinit>(Closure.java:193)
    at java.base/java.lang.Class.forName0(Native Method)
    at java.base/java.lang.Class.forName(Class.java:375)
    at picocli.CommandLine$DefaultFactory.loadClosureClass(CommandLine.java:5477)
    at picocli.CommandLine$DefaultFactory.<clinit>(CommandLine.java:5475)
    at picocli.CommandLine.<init>(CommandLine.java:196)
    at picocli.CommandLine$Model$CommandSpec.addSubcommand(CommandLine.java:6405)
    at liquibase.integration.commandline.LiquibaseCommandLine.addSubcommandGroup(LiquibaseCommandLine.java:878)
    at liquibase.integration.commandline.LiquibaseCommandLine.getParentCommandSpec(LiquibaseCommandLine.java:835)
    at liquibase.integration.commandline.LiquibaseCommandLine.addSubcommand(LiquibaseCommandLine.java:788)
    at liquibase.integration.commandline.LiquibaseCommandLine.buildPicoCommandLine(LiquibaseCommandLine.java:199)
    at liquibase.integration.commandline.LiquibaseCommandLine.<init>(LiquibaseCommandLine.java:174)
    at liquibase.integration.commandline.LiquibaseCommandLine.main(LiquibaseCommandLine.java:78)

> Task :liquibase:snapshot FAILED

Execution failed for task ':liquibase:snapshot'
stevesaliman commented 1 year ago

I haven't been able to reproduce this error. Is it still a problem with the latest release of the plugin (2.2.0), and Liquibase 4.4+?

copenhaverjf commented 10 months ago

For anyone who's seeing this issue, I was originally experiencing this issue with v2.2.1 of the plugin gradle 7.4 Java 17 and liquibase 4.5.0.

I upgraded liquibase deps to the latest (4.25.1) and the error disappeared.