Search code examples
grailsgrails-plugingrails-4

Quartz not working in Grails4, Issue in dependency not able to compile


Getting error in Scheduler Dependency i'm using grails4 : Anyone let me know correct dependency for scheduler

dependencies {
compile "org.grails.plugins:quartz:2.0.1"

}

and also tried this:

dependencies {
compile "com.agileorbit:schwartz:1.0.1"

}

Both are not able to compile:

grails run-app | Resolving Dependencies. Please wait...

| Running application...

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':compileGroovy'.

    org/quartz/JobExecutionContext

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 10s | Error Failed to start server (Use --stacktrace to see the full trace)


Solution

  • You will need to add the quartz dependency explicitly in addition to the plugin as Gradle 5 stopped pulling in transitive dependancies. Also I'd suggest using the latest version (2.0.13 vs 2.0.1 which is quite old)

    buildscript {
        dependencies {
            classpath 'org.grails.plugins:quartz:2.0.13' // Needed to compile *Job classes
        }
    }
    
    dependencies {
        compile 'org.grails.plugins:quartz:2.0.13'
        compile 'org.quartz-scheduler:quartz:2.2.1' // Is not pulled in by default
    }