We recently upgraded our project from Grails 3 to 5.1.1. Actually, it was not really an upgrade but rather a migration. We ended up creating a fresh project with 5.1.1 and migrated all of our code into it. Everything is currently working with an exception of one warning:
> Task :compileGsonViews
Execution optimizations have been disabled for task ':compileGsonViews' to ensure correctness due to the following reasons:
- Gradle detected a problem with the following location: '/Users/shurikag/PRIZ/dev/priz-api/build/gson-classes/main'. Reason: Task ':bootWarMainClassName' uses this output of task ':compileGsonViews' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. Please refer to https://docs.gradle.org/7.3.3/userguide/validation_problems.html#implicit_dependency for more details about this problem.
And in fact, as our newrelic shows, the app is now extremely slow on gson rendering. Usually the first time an endpoint is called, it is very slow, the subsequent calls are OK.
Is there a solution for it?
Here is our build.gradle:
buildscript {
repositories {
maven {
url "https://repo.grails.org/grails/core"
}
maven {
url "https://repo.grails.org/artifactory/core"
}
mavenCentral()
}
dependencies {
classpath "org.grails:grails-gradle-plugin:$grailsGradlePluginVersion"
classpath "org.grails.plugins:hibernate5:7.2.0"
classpath "org.grails.plugins:views-gradle:2.1.2"
classpath "gradle.plugin.com.github.erdi.webdriver-binaries:webdriver-binaries-gradle-plugin:2.6"
classpath 'org.grails.plugins:database-migration:3.1.0'
}
}
version "0.1"
group "priz.api"
apply plugin: "eclipse"
apply plugin: "idea"
// apply plugin:"visual-studio"
apply plugin: "war"
apply plugin: "org.grails.grails-web"
apply plugin: "org.grails.plugins.views-json"
apply plugin: "com.github.erdi.webdriver-binaries"
repositories {
maven {
url "https://repo.grails.org/grails/core"
}
maven {
url "https://repo.grails.org/artifactory/core"
}
mavenCentral()
}
configurations {
developmentOnly
runtimeClasspath {
extendsFrom developmentOnly
}
}
dependencies {
implementation platform('com.amazonaws:aws-java-sdk-bom:1.11.1000')
implementation 'com.amazonaws:aws-java-sdk-s3'
developmentOnly("org.springframework.boot:spring-boot-devtools")
compileOnly "io.micronaut:micronaut-inject-groovy"
// https://mvnrepository.com/artifact/io.micronaut/micronaut-core
implementation 'io.micronaut:micronaut-core:3.2.6'
console "org.grails:grails-console"
implementation "org.springframework.boot:spring-boot-starter-logging:2.6.2"
implementation "org.springframework.boot:spring-boot-starter-validation:2.6.2"
implementation "org.springframework.boot:spring-boot-autoconfigure:2.6.2"
implementation "org.grails:grails-core"
implementation "org.springframework.boot:spring-boot-starter-actuator:2.6.2"
implementation "org.springframework.boot:spring-boot-starter-tomcat:2.6.2"
implementation "org.grails:grails-plugin-url-mappings"
implementation "org.grails:grails-plugin-rest"
implementation "org.grails:grails-plugin-codecs"
implementation "org.grails:grails-plugin-interceptors"
implementation "org.grails:grails-plugin-services"
implementation "org.grails:grails-plugin-datasource"
implementation "org.grails:grails-plugin-databinding"
implementation "org.grails:grails-web-boot"
implementation "org.grails:grails-logging"
implementation "org.grails.plugins:cache"
implementation "org.grails.plugins:async"
implementation "org.grails.plugins:events"
implementation "org.grails.plugins:hibernate5"
implementation "org.hibernate:hibernate-core:5.6.3.Final"
implementation 'org.hibernate:hibernate-ehcache:5.6.3.Final'
implementation "org.grails.plugins:views-json:2.1.2"
implementation "org.grails.plugins:views-json-templates:2.1.2"
profile "org.grails.profiles:rest-api"
runtimeOnly "org.glassfish.web:el-impl:2.2.1-b05"
runtimeOnly "com.h2database:h2"
runtimeOnly "org.apache.tomcat:tomcat-jdbc"
runtimeOnly "javax.xml.bind:jaxb-api:2.3.1"
testImplementation "io.micronaut:micronaut-inject-groovy"
testImplementation "org.grails:grails-gorm-testing-support"
testImplementation "org.mockito:mockito-core"
testImplementation "io.micronaut:micronaut-http-client"
testImplementation "org.grails:grails-web-testing-support"
testImplementation "org.grails:views-json-testing-support"
testImplementation "org.hibernate.validator:hibernate-validator:6.1.7.Final"
testImplementation "org.grails.plugins:geb"
testImplementation "org.seleniumhq.selenium:selenium-remote-driver:4.0.0"
testImplementation "org.seleniumhq.selenium:selenium-api:4.0.0"
testImplementation "org.seleniumhq.selenium:selenium-support:4.0.0"
testRuntimeOnly "org.seleniumhq.selenium:selenium-chrome-driver:4.0.0"
testRuntimeOnly "org.seleniumhq.selenium:selenium-firefox-driver:4.0.0"
runtimeOnly "org.grails.plugins:async:4.0.0"
implementation 'org.grails.plugins:postgresql-extensions:7.0.0'
implementation "org.postgresql:postgresql:42.3.1"
implementation 'org.grails.plugins:database-migration:3.1.0'
implementation 'org.liquibase:liquibase-core:3.10.3'
implementation "org.grails.plugins:spring-security-core:4.0.3"
implementation "org.grails.plugins:spring-security-rest:3.0.1"
implementation 'com.auth0:auth0:1.35.0'
implementation 'com.auth0:jwks-rsa:0.20.0'
implementation 'com.sendinblue:sib-api-v3-sdk:5.2.0'
implementation 'com.papertrailapp:logback-syslog4j:1.0.0'
implementation "com.stripe:stripe-java:17.11.0"
implementation "org.grails:grails-datastore-gorm-async"
implementation 'org.quartz-scheduler:quartz:2.3.2'
implementation 'com.squareup.okhttp3:okhttp:4.9.3'
implementation 'co.elastic.clients:elasticsearch-java:7.16.2'
implementation 'jakarta.json:jakarta.json-api:2.0.1'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.12.3'
}
sourceSets {
main {
resources {
srcDir 'grails-app/migrations'
}
}
}
bootRun {
ignoreExitValue true
jvmArgs(
'-Dspring.output.ansi.enabled=always',
'-noverify',
'-XX:TieredStopAtLevel=1',
'-Xmx1024m')
sourceResources sourceSets.main
String springProfilesActive = 'spring.profiles.active'
systemProperty springProfilesActive, System.getProperty(springProfilesActive)
}
tasks.withType(GroovyCompile) {
configure(groovyOptions) {
forkOptions.jvmArgs = ['-Xmx1024m']
}
}
tasks.withType(Test) {
useJUnitPlatform()
}
webdriverBinaries {
chromedriver '2.45.0'
geckodriver '0.30.0'
}
tasks.withType(Test) {
systemProperty "geb.env", System.getProperty('geb.env')
systemProperty "geb.build.reportsDir", reporting.file("geb/integrationTest")
systemProperty "webdriver.chrome.driver", System.getProperty('webdriver.chrome.driver')
systemProperty "webdriver.gecko.driver", System.getProperty('webdriver.gecko.driver')
}
CodePudding user response:
I managed to get the error to go away. All I needed to do it all the dependency config for the related tasks (in build.gradle):
tasks.named('bootWarMainClassName') {
it.mustRunAfter(tasks.named('compileGsonViews'))
}
However, that sis not help the performance :(
