title: Execution optimizations have been disabled for task ':compileGsonViews'
body: <p>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:</p>
  <pre><code>&gt; 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.
  </code></pre>
  <p>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.</p>
  <p>Is there a solution for it?</p>
  <p>Here is our <code>build.gradle</code>:</p>
  <pre><code>buildscript {
      repositories {
          maven {
              url &quot;https://repo.grails.org/grails/core&quot;
          }
          maven {
              url &quot;https://repo.grails.org/artifactory/core&quot;
          }
          mavenCentral()
      }
      dependencies {
          classpath &quot;org.grails:grails-gradle-plugin:$grailsGradlePluginVersion&quot;
          classpath &quot;org.grails.plugins:hibernate5:7.2.0&quot;
          classpath &quot;org.grails.plugins:views-gradle:2.1.2&quot;
          classpath &quot;gradle.plugin.com.github.erdi.webdriver-binaries:webdriver-binaries-gradle-plugin:2.6&quot;
          classpath 'org.grails.plugins:database-migration:3.1.0'
      }
  }
  
  version &quot;0.1&quot;
  group &quot;priz.api&quot;
  
  apply plugin: &quot;eclipse&quot;
  apply plugin: &quot;idea&quot;
  // apply plugin:&quot;visual-studio&quot;
  apply plugin: &quot;war&quot;
  apply plugin: &quot;org.grails.grails-web&quot;
  apply plugin: &quot;org.grails.plugins.views-json&quot;
  apply plugin: &quot;com.github.erdi.webdriver-binaries&quot;
  
  repositories {
      maven {
          url &quot;https://repo.grails.org/grails/core&quot;
      }
      maven {
          url &quot;https://repo.grails.org/artifactory/core&quot;
      }
      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(&quot;org.springframework.boot:spring-boot-devtools&quot;)
      compileOnly &quot;io.micronaut:micronaut-inject-groovy&quot;
      // https://mvnrepository.com/artifact/io.micronaut/micronaut-core
      implementation 'io.micronaut:micronaut-core:3.2.6'
  
      console &quot;org.grails:grails-console&quot;
      implementation &quot;org.springframework.boot:spring-boot-starter-logging:2.6.2&quot;
      implementation &quot;org.springframework.boot:spring-boot-starter-validation:2.6.2&quot;
      implementation &quot;org.springframework.boot:spring-boot-autoconfigure:2.6.2&quot;
      implementation &quot;org.grails:grails-core&quot;
      implementation &quot;org.springframework.boot:spring-boot-starter-actuator:2.6.2&quot;
      implementation &quot;org.springframework.boot:spring-boot-starter-tomcat:2.6.2&quot;
      implementation &quot;org.grails:grails-plugin-url-mappings&quot;
      implementation &quot;org.grails:grails-plugin-rest&quot;
      implementation &quot;org.grails:grails-plugin-codecs&quot;
      implementation &quot;org.grails:grails-plugin-interceptors&quot;
      implementation &quot;org.grails:grails-plugin-services&quot;
      implementation &quot;org.grails:grails-plugin-datasource&quot;
      implementation &quot;org.grails:grails-plugin-databinding&quot;
      implementation &quot;org.grails:grails-web-boot&quot;
      implementation &quot;org.grails:grails-logging&quot;
      implementation &quot;org.grails.plugins:cache&quot;
      implementation &quot;org.grails.plugins:async&quot;
      implementation &quot;org.grails.plugins:events&quot;
      implementation &quot;org.grails.plugins:hibernate5&quot;
      implementation &quot;org.hibernate:hibernate-core:5.6.3.Final&quot;
      implementation 'org.hibernate:hibernate-ehcache:5.6.3.Final'
      implementation &quot;org.grails.plugins:views-json:2.1.2&quot;
      implementation &quot;org.grails.plugins:views-json-templates:2.1.2&quot;
      profile &quot;org.grails.profiles:rest-api&quot;
      runtimeOnly &quot;org.glassfish.web:el-impl:2.2.1-b05&quot;
      runtimeOnly &quot;com.h2database:h2&quot;
      runtimeOnly &quot;org.apache.tomcat:tomcat-jdbc&quot;
      runtimeOnly &quot;javax.xml.bind:jaxb-api:2.3.1&quot;
      testImplementation &quot;io.micronaut:micronaut-inject-groovy&quot;
      testImplementation &quot;org.grails:grails-gorm-testing-support&quot;
      testImplementation &quot;org.mockito:mockito-core&quot;
      testImplementation &quot;io.micronaut:micronaut-http-client&quot;
      testImplementation &quot;org.grails:grails-web-testing-support&quot;
      testImplementation &quot;org.grails:views-json-testing-support&quot;
      testImplementation &quot;org.hibernate.validator:hibernate-validator:6.1.7.Final&quot;
      testImplementation &quot;org.grails.plugins:geb&quot;
      testImplementation &quot;org.seleniumhq.selenium:selenium-remote-driver:4.0.0&quot;
      testImplementation &quot;org.seleniumhq.selenium:selenium-api:4.0.0&quot;
      testImplementation &quot;org.seleniumhq.selenium:selenium-support:4.0.0&quot;
      testRuntimeOnly &quot;org.seleniumhq.selenium:selenium-chrome-driver:4.0.0&quot;
      testRuntimeOnly &quot;org.seleniumhq.selenium:selenium-firefox-driver:4.0.0&quot;
      runtimeOnly &quot;org.grails.plugins:async:4.0.0&quot;
  
      implementation 'org.grails.plugins:postgresql-extensions:7.0.0'
      implementation &quot;org.postgresql:postgresql:42.3.1&quot;
      implementation 'org.grails.plugins:database-migration:3.1.0'
      implementation 'org.liquibase:liquibase-core:3.10.3'
  
      implementation &quot;org.grails.plugins:spring-security-core:4.0.3&quot;
      implementation &quot;org.grails.plugins:spring-security-rest:3.0.1&quot;
      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 &quot;com.stripe:stripe-java:17.11.0&quot;
      implementation &quot;org.grails:grails-datastore-gorm-async&quot;
      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 &quot;geb.env&quot;, System.getProperty('geb.env')
      systemProperty &quot;geb.build.reportsDir&quot;, reporting.file(&quot;geb/integrationTest&quot;)
      systemProperty &quot;webdriver.chrome.driver&quot;, System.getProperty('webdriver.chrome.driver')
      systemProperty &quot;webdriver.gecko.driver&quot;, System.getProperty('webdriver.gecko.driver')
  }
  </code></pre>
  <p><strong>UPDATE</strong></p>
  <p>Steps to reproduce on a freshly made project</p>
  <pre><code>~/PRIZ/dev $ grails -v
  | Grails Version: 5.1.1
  | JVM Version: 11.0.12
  ~/PRIZ/dev $ grails create-app myapp --profile=rest-api
  | Application created at /Users/shurikag/PRIZ/dev/myapp
  ~/PRIZ/dev $ cd myapp
  ~/PRIZ/dev/myapp $ ./gradlew assemble
  Starting a Gradle Daemon (subsequent builds will be faster)
  
  &gt; Task :compileGroovy
  09:32:41.216 [/127.0.0.1:57662 to /127.0.0.1:57661 workers] DEBUG io.micronaut.core.optim.StaticOptimizations - No optimizations class io.micronaut.core.io.service.SoftServiceLoader$Optimizations found
  09:32:41.826 [/127.0.0.1:57662 to /127.0.0.1:57661 workers] DEBUG io.micronaut.core.optim.StaticOptimizations - No optimizations class io.micronaut.core.reflect.ClassUtils$Optimizations found
  09:32:42.282 [/127.0.0.1:57662 to /127.0.0.1:57661 workers] DEBUG io.micronaut.core.optim.StaticOptimizations - No optimizations class io.micronaut.core.util.EnvironmentProperties found
  
  &gt; 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/myapp/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.2/userguide/validation_problems.html#implicit_dependency for more details about this problem.
  09:32:44.382 [main] DEBUG io.micronaut.core.optim.StaticOptimizations - No optimizations class io.micronaut.core.reflect.ClassUtils$Optimizations found
  09:32:44.388 [main] DEBUG io.micronaut.core.optim.StaticOptimizations - No optimizations class io.micronaut.core.util.EnvironmentProperties found
  09:32:45.040 [pool-1-thread-2] DEBUG io.micronaut.core.optim.StaticOptimizations - No optimizations class io.micronaut.core.io.service.SoftServiceLoader$Optimizations found
  
  Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
  
  You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
  
  See https://docs.gradle.org/7.2/userguide/command_line_interface.html#sec:command_line_warnings
  
  Execution optimizations have been disabled for 1 invalid unit(s) of work during this build to ensure correctness.
  Please consult deprecation warnings for more details.
  </code></pre>
  <p><strong>UPDATE</strong></p>
  <p>If I update <code>grailsGradlePluginVersion</code> to <code>5.1.1</code> and run the app with <code>grails run-app</code>, I am facing another issue:</p>
  <pre><code>| Running application...
  &lt;=============&gt; 100% EXECUTING [16s]
  &gt; IDLE
  Failed to instantiate [ch.qos.logback.classic.LoggerContext]
  Reported exception:
  ch.qos.logback.core.LogbackException: Unexpected filename extension of file [file:/Users/shurikag/PRIZ/dev/priz-api/grails-app/conf/logback.groovy]. Should be either .groovy or .xml
          at ch.qos.logback.classic.util.ContextInitializer.configureByResource(ContextInitializer.java:67)
          at ch.qos.logback.classic.util.ContextInitializer.autoConfig(ContextInitializer.java:140)
          at org.slf4j.impl.StaticLoggerBinder.init(StaticLoggerBinder.java:84)
          at org.slf4j.impl.StaticLoggerBinder.&lt;clinit&gt;(StaticLoggerBinder.java:55)
          at org.slf4j.LoggerFactory.bind(LoggerFactory.java:150)
          at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:124)
          at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:417)
          at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:362)
          at org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(SLF4JLogFactory.java:155)
          at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:290)
  </code></pre>