Execution optimizations have been disabled for task ':compileGsonViews' - gradle

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')
}
UPDATE
Steps to reproduce on a freshly made project
~/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)
> 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
> 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.
UPDATE
If I update grailsGradlePluginVersion to 5.1.1 and run the app with grails run-app, I am facing another issue:
| Running application...
<=============> 100% EXECUTING [16s]
> 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.<clinit>(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)

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 :(

I had the same error, upgrading to grails 5.1.2 results in the error still logging out but no longer causes it to actually fail

Related

How to generate QueryDSL mongoDB and lombok in (modern) gradle

Getting both QueryDSL and lombok to work together is not simple, especially since gradle documentation for querydsl is lacking at best.
I want to avoid using autdated plugins that still depend on the compile configuration or that are hacking in extra tasks that break other systems (like the intellij idea build).
Going through everything that did not work will take me a while so instead I'm leaving this question & answer here for others (and possibly my future self).
This is (so far) the simplest way to get the compile step to take both queryDSL and lombok correctly into account. The spring-data-mongo starter requirement on annotation processor might be overkill and can possible be done better.
plugins {
id 'java'
id 'org.springframework.boot'
id 'io.spring.dependency-management'
}
repositories {
mavenCentral()
}
sourceCompatibility = '17'
ext{
springBootVersion = "2.7.4"
}
dependencies {
implementation(platform("org.springframework.boot:spring-boot-dependencies:${springBootVersion}"))
implementation 'org.springframework.boot:spring-boot-starter-data-mongodb'
implementation 'org.springframework.boot:spring-boot-starter-web'
testImplementation "org.springframework.boot:spring-boot-starter-test"
testImplementation 'de.flapdoodle.embed:de.flapdoodle.embed.mongo'
}
ext {
queryDslVersion = "5.0.0"
}
configurations {
compileOnly {
extendsFrom annotationProcessor
}
}
dependencies {
//required to use dependency management to find the right versions. Alternatively specify the version in the dependency directly
annotationProcessor(platform("org.springframework.boot:spring-boot-dependencies:${springBootVersion}"))
compileOnly "org.projectlombok:lombok"
annotationProcessor "org.projectlombok:lombok"
testCompileOnly "org.projectlombok:lombok"
testAnnotationProcessor "org.projectlombok:lombok"
//querydsl
implementation("com.querydsl:querydsl-core:${queryDslVersion}")
annotationProcessor("com.querydsl:querydsl-apt:${queryDslVersion}:general")
//I'm lazily using the full starter here to automatically include other annotation dependencies like validation. You could specify them separately/specifically
annotationProcessor('org.springframework.boot:spring-boot-starter-data-mongodb')
}
//adding both annotation processors directly on the compiler options make them work together nicely.
compileJava {
options.compilerArgs += [
"-processor", 'lombok.launch.AnnotationProcessorHider$AnnotationProcessor,org.springframework.data.mongodb.repository.support.MongoAnnotationProcessor'
]
}

Grails 5.2.0 create-app, throws "Cannot resolve dependency org.springframework.boot:spring-boot-dependencies:2.7.0 no repositories are defined"

I am starting a new grails application, I am using grails 5.2.0 (Latest as of today)
I generated a skeleton using :
~/grails-5.2.0/bin/grails create-app data_portal --profile=react
However, trying to run the application always gives me following error :
Configure project :server
Cannot resolve reloading agent JAR: Failed to resolve imported Maven boms: Cannot resolve external dependency org.springframework.boot:spring-boot-dependencies:2.7.0 because no repositories are defined.
Required by:
project :server
FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
Where:
Build file '.../server/build.gradle' line: 20
What went wrong:
A problem occurred evaluating project ':server'.
Receiver class grails.util.Environment does not define or inherit an implementation of the resolved method 'abstract java.lang.Object getProperty(java.lang.String)' of interface groovy.lang.GroovyObject.
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.
==============================================================================
2: Task failed with an exception.
What went wrong:
A problem occurred configuring project ':server'.
Failed to notify project evaluation listener.
Receiver class grails.util.Environment does not define or inherit an implementation of the resolved method 'abstract java.lang.Object getProperty(java.lang.String)' of interface groovy.lang.GroovyObject.
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
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.9/userguide/command_line_interface.html#sec:command_line_warnings
CONFIGURE FAILED in 233ms
This is how my settings.gradle looks like
include 'client', 'server'
This is how my server/build.gradle looks like
buildscript {
repositories {
maven { url "https://repo.grails.org/grails/core" }
maven { url "https://plugins.gradle.org/m2/" }
}
dependencies {
classpath "org.grails:grails-gradle-plugin:$grailsGradlePluginVersion"
classpath "com.github.node-gradle:gradle-node-plugin:1.3.0"
classpath "org.grails.plugins:hibernate5:7.3.0"
classpath "org.grails.plugins:views-gradle:2.3.2"
}
}
version "0.1"
group "dp"
apply plugin:"eclipse"
apply plugin:"idea"
apply plugin:"war"
apply plugin:"org.grails.grails-web"
apply plugin:"com.github.node-gradle.node"
apply plugin:"org.grails.plugins.views-json"
repositories {
maven { url "https://repo.grails.org/grails/core" }
}
dependencyManagement {
imports {
mavenBom('org.springframework.boot:spring-boot-dependencies:2.7.0')
}
applyMavenExclusions false
}
configurations {
developmentOnly
runtimeClasspath {
extendsFrom developmentOnly
}
}
dependencies {
developmentOnly("org.springframework.boot:spring-boot-devtools")
compileOnly "io.micronaut:micronaut-inject-groovy"
console "org.grails:grails-console"
implementation "org.springframework.boot:spring-boot-starter-logging"
implementation "org.springframework.boot:spring-boot-starter-validation"
implementation "org.springframework.boot:spring-boot-autoconfigure"
implementation "org.grails:grails-core"
implementation "org.springframework.boot:spring-boot-starter-actuator"
implementation "org.springframework.boot:spring-boot-starter-tomcat"
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:hibernate5"
implementation "org.hibernate:hibernate-core:5.6.9.Final"
implementation "org.grails.plugins:views-json"
implementation "org.grails.plugins:views-json-templates"
profile "org.grails.profiles:react"
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"
}
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()
}
This is how my client/build.gradle looks like:
plugins {
id "com.github.node-gradle.node" version "1.3.0"
}
node {
version = '10.15.0' // https://nodejs.org/en/
yarnVersion = '1.13.0' // https://yarnpkg.com/en/
download = true
}
task bootRun(dependsOn: 'start') {
group = 'application'
description = 'Run the client app (for use with gradle bootRun -parallel'
}
task start(type: YarnTask, dependsOn: 'yarn') {
group = 'application'
description = 'Run the client app'
args = ['run', 'start']
}
task build(type: YarnTask, dependsOn: 'yarn') {
group = 'build'
description = 'Build the client bundle'
args = ['run', 'build']
}
task test(type: YarnTask, dependsOn: 'yarn') {
group = 'verification'
description = 'Run the client tests'
args = ['run', 'test']
}
task eject(type: YarnTask, dependsOn: 'yarn') {
group = 'other'
description = 'Eject from the create-react-app scripts'
args = ['run', 'eject']
}
This seem to be resolving after changing grailsGradlePluginVersion from grailsGradlePluginVersion=5.2 to grailsGradlePluginVersion=5.1.x. in gradle.properties
It looks from the deprecation warning like you were building using Gradle 6.9.
Grails 5 requires Gradle 7.
I encountered the same issue by accidentally using the gradle command instead of gradlew.
gradlew uses the version of Gradle from the project's Gradle Wrapper, but the gradle command will run whatever Gradle version is on your PATH -- in my case 6.9.2 -- so I got the same exception.
For others in the same situation:
If your project has a wrapper, run ./gradlew build from the project's ROOT
If your project has no wrapper, you can add one by running gradle wrapper --gradle-version 7.2 from the project's ROOT
If you don't want to use a wrapper, install Gradle 7.x, set your GRADLE_HOME environment variable to the new install location (instead of your v6 or earlier install) and gradle build should work fine.

Error Error initializing classpath: Plugin with id 'org.grails.plugins.views-json' not found

I am working with Grails 3.3.11 and Java 1.8.0_275 (open).
All of a sudden my project stopped working. When I run grails clean, or run-app it says:
* Where:
Build file '/media/alfredo/1TBHDD/CMB/Code projects/Grails 3/plataforma-mserp/build.gradle' line: 22
* What went wrong:
A problem occurred evaluating root project 'cmberp'.
> Plugin with id 'org.grails.plugins.views-json' not found.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
CONFIGURE FAILED
Total time: 1.121 secs
| Error Error initializing classpath: Plugin with id 'org.grails.plugins.views-json' not found. (Use --stacktrace to see the full trace)
Here is my build.gradle file. It indicates an error in the lines 22 and 72. I don't know why it is happening because it was working as expected. Maybe some configuration. The only thing I added to this project was jgit-flow configuration.
buildscript {
repositories {
mavenLocal()
maven { url "http://repo.grails.org/grails/core" }
}
dependencies {
classpath files('gradle/gradle-trust-all.jar')
classpath "org.grails:grails-gradle-plugin:$grailsVersion"
classpath "org.grails.plugins:hibernate5:${gormVersion-".RELEASE"}"
classpath "org.grails.plugins:views-gradle:1.2.9"
classpath 'io.github.robwin:jgitflow-gradle-plugin:0.6.0'
}
}
version "$version"
group "br.gov.cmb"
apply plugin:"eclipse"
apply plugin:"idea"
apply plugin:"war"
apply plugin:"org.grails.grails-web"
apply plugin:"org.grails.plugins.views-json"
apply plugin: 'io.github.robwin.jgitflow'
repositories {
mavenLocal()
maven { url "http://repo.grails.org/grails/core" }
}
dependencies {
compile "org.springframework.boot:spring-boot-starter-logging"
compile "org.springframework.boot:spring-boot-autoconfigure"
compile "org.grails:grails-core"
compile "org.springframework.boot:spring-boot-starter-actuator"
compile "org.springframework.boot:spring-boot-starter-tomcat"
compile "org.grails:grails-plugin-url-mappings"
compile "org.grails:grails-plugin-rest"
compile "org.grails:grails-plugin-codecs"
compile "org.grails:grails-plugin-interceptors"
compile "org.grails:grails-plugin-services"
compile "org.grails:grails-plugin-datasource"
compile "org.grails:grails-plugin-databinding"
compile "org.grails:grails-web-boot"
compile "org.grails:grails-logging"
compile "org.grails.plugins:cache"
compile "org.grails.plugins:async"
compile "org.grails.plugins:events"
compile "org.grails.plugins:hibernate5"
compile "org.hibernate:hibernate-core:5.1.16.Final"
compile "org.grails.plugins:views-json"
compile "org.grails.plugins:views-json-templates"
compile "com.microsoft.sqlserver:mssql-jdbc" //Added by cmb developer
compile 'org.grails.plugins:quartz:2.0.13' //Added by cmb developer
console "org.grails:grails-console"
profile "org.grails.profiles:rest-api"
runtime "org.glassfish.web:el-impl:2.1.2-b03"
runtime "com.h2database:h2"
runtime "org.apache.tomcat:tomcat-jdbc"
testCompile "org.grails:grails-gorm-testing-support"
testCompile "org.grails:grails-datastore-rest-client"
testCompile "org.grails:grails-web-testing-support"
testCompile "org.grails.plugins:geb:1.1.2"
testRuntime "org.seleniumhq.selenium:selenium-chrome-driver:2.47.1"
testRuntime "org.seleniumhq.selenium:selenium-htmlunit-driver:2.47.1"
testRuntime "net.sourceforge.htmlunit:htmlunit:2.18"
}
bootRun {
jvmArgs('-Dspring.output.ansi.enabled=always')
addResources = true
String springProfilesActive = 'spring.profiles.active'
systemProperty springProfilesActive, System.getProperty(springProfilesActive)
}
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')
}
Please help me!
Thanks.
Alfredo
This is likely due to a repository outage that is in progress right now. See https://github.com/grails/grails-core/issues/11825.

Gradle build fails with HTTPS required error

This my build script
plugins {
id 'java'
id 'maven-publish'
}
repositories {
mavenCentral()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-solr:2.2.6.RELEASE'
implementation 'org.springframework.boot:spring-boot-starter-web:2.2.6.RELEASE'
implementation 'org.springframework.boot:spring-boot-starter-websocket:2.2.6.RELEASE'
implementation 'com.okta.spring:okta-spring-boot-starter:1.4.0'
implementation 'org.springframework.boot:spring-boot-starter-log4j2:2.2.6.RELEASE'
implementation 'org.springframework.boot:spring-boot-starter:2.2.6.RELEASE'
implementation 'org.janusgraph:janusgraph-core:0.5.1'
implementation 'org.janusgraph:janusgraph-cassandra:0.5.1'
implementation 'org.janusgraph:janusgraph-cql:0.5.1'
implementation 'io.dropwizard.metrics:metrics-core:3.2.2'
implementation 'org.janusgraph:janusgraph-solr:0.5.1'
implementation 'org.apache.solr:solr-solrj:7.7.3'
implementation 'org.projectlombok:lombok:1.18.12'
testImplementation 'org.springframework.boot:spring-boot-starter-test:2.2.6.RELEASE'
testImplementation 'org.assertj:assertj-core:3.16.0'
testImplementation 'org.testcontainers:testcontainers:1.14.1'
}
When I run 'gradle buld' I get error:
Execution failed for task ':compileJava'.
> Could not resolve all files for configuration ':compileClasspath'.
> Could not resolve io.dropwizard.metrics:metrics-graphite:3.2.2.
Required by:
project : > org.janusgraph:janusgraph-core:0.5.1
> Could not resolve io.dropwizard.metrics:metrics-graphite:3.2.2.
> Could not get resource 'http://repo.maven.apache.org/maven2/io/dropwizard/metrics/metrics-graphite/3.2.2/metrics-graphite-3.2.2.pom'.
> Could not HEAD 'http://repo.maven.apache.org/maven2/io/dropwizard/metrics/metrics-graphite/3.2.2/metrics-graphite-3.2.2.pom'. Received status code 501 from server: HTTPS Required
What am I doing wrong here?

Spring Cloud Stream Configuration classes are not being loaded

After updating from Spring Boot 2.0.6 / Spring Cloud Finchley.RELEASE to Spring Boot 2.1.3 / Spring Cloud Greenwich.SR1, I am experiencing a very odd configuration / component scanning issue.
The application is structured as follows:
main-application
messaging-lib
commons-lib
Main application is annotated with #SpringBootApplication(scanBasePackages = {"com.app.libs", "com.app"}), where the com.app packages are those under the main-application, while com.app.libs are the packages of the libs.
The commons-lib configuration which is simply a framework-esque library has the following main configuration entrypoint:
package com.app.libs.commons
#Target(ElementType.TYPE)
#Retention(RetentionPolicy.RUNTIME)
#Documented
#Inherited
#Import(CommonsConfiguration.class)
public #interface EnableCommons {
}
With CommonsConfiguration having:
package com.app.libs.commons.config
#Configuration
#ConditionalOnProperty(value = "com.app.config.commons", matchIfMissing = true)
#ComponentScan(basePackages = "com.app.libs.commons")
public class FrameworkConfiguration {
This way, I can basically annotate a single configuration class in my main-application and have it pick up common beans.
The messaging-lib configuration which uses Spring Cloud Stream has the following configurations:
#Configuration
#Import({ CustomBinding.class })
#PropertySource("classpath:kafka.properties")
#EnableBinding(Source.class)
#EnableAutoConfiguration
public class BindingConfiguration {
}
The cloud stream configuration is as follows:
spring.cloud.stream.bindings.output.destination=${spring.application.name}
spring.cloud.stream.kafka.bindings.output.producer.sync=true
spring.cloud.stream.default.group=${spring.application.name}
spring.cloud.stream.default.producer.partitionCount=9
spring.cloud.stream.default.producer.partitionKeyExpression=headers.entityId
spring.cloud.stream.kafka.binder.autoAddPartitions=true
spring.cloud.stream.kafka.binder.autoCreateTopics=false
When starting the application, the following error message is produced:
***************************
APPLICATION FAILED TO START
***************************
Description:
Failed to bind properties under 'spring.cloud.stream.default.producer.partition-key-expression' to org.springframework.expression.Expression:
Property: spring.cloud.stream.default.producer.partitionkeyexpression
Value: headers.entityId
Origin: "spring.cloud.stream.default.producer.partitionKeyExpression" from property source "class path resource [kafka.properties]"
Reason: No converter found capable of converting from type [java.lang.String] to type [#com.fasterxml.jackson.databind.annotation.JsonSerialize org.springframework.expression.Expression]
Action:
Update your application's configuration
After some looking through the source code, I've noticed that the SpelConverter in question is the one that is supposed to be initialized in SpelExpressionConverterConfiguration. Indeed, if I add #Import({ SpelExpressionConverterConfiguration.class }) or #Import({ BindingServiceConfiguration }) (the #Configuration class that imports the SpelExpressionConverterConfiguration) to my BindingConfiguration, the converter seems to get initialized. However, another error is then produced:
***************************
APPLICATION FAILED TO START
***************************
Description:
A component required a bean of type 'org.springframework.messaging.core.DestinationResolver' that could not be found.
The following candidates were found but could not be injected:
- Bean method 'binderAwareChannelResolver' in 'BindingServiceConfiguration' not loaded because #ConditionalOnBean (types: org.springframework.cloud.stream.binder.BinderTypeRegistry; SearchStrategy: current) did not find any beans of type org.springframework.cloud.stream.binder.BinderTypeRegistry
Action:
Consider revisiting the entries above or defining a bean of type 'org.springframework.messaging.core.DestinationResolver' in your configuration.
I'm not quite sure what seems to be going on. When debugging, it seems that both BindingBeansRegistrar and BinderFactoryConfiguration (the classes imported through #EnableBinding) are loaded - yet no scanning occurs and the rest of the component scanning simply does not seem to happen.
I've tried importing the configuration classes and/or scanning the packages myself, but in both cases I am still missing the DestinationResolver bean, although it should have been initialized.
I've noted that, prior to the update, there were also some issues: I had to import BindingServiceConfiguration, BinderFactoryConfiguration, and SpelExpressionConverterConfiguration manually as well.
Would anybody have pointers as to what could be causing this issue?
EDIT: Here are the build.grade files (some includes are omitted for brevity):
Application build.gradle
apply from: new File(project(':scripts').projectDir, '/service-impl.gradle')
dependencies {
implementation project(':dependency-A')
implementation project(':dependency-B')
implementation project(':messaging-library')
testImplementation 'org.springframework.cloud:spring-cloud-stream-test-support'
}
service-impl.gradle contents:
buildscript {
apply from: new File(project(':buildscripts').projectDir, '/repositories.gradle') // Repository definitions
apply from: new File(project(':buildscripts').projectDir, '/dm-boot.gradle') // DM via spring boot plugin
apply from: new File(project(':buildscripts').projectDir, '/dm-versions.gradle') // DM versions
}
configurations {
all*.exclude module: 'spring-boot-starter-tomcat'
all*.exclude group: 'org.apache.bval'
}
artifacts {
archives bootJar
}
dependencies {
compileOnly 'org.projectlombok:lombok'
compile 'org.springframework.boot:spring-boot-starter'
compile 'org.springframework.boot:spring-boot-starter-web'
compile 'org.springframework.boot:spring-boot-starter-jetty'
compile 'org.springframework.boot:spring-boot-starter-actuator'
compile 'org.springframework.boot:spring-boot-starter-cache'
compile 'org.springframework.cloud:spring-cloud-starter-netflix-eureka-client'
compile 'org.springframework.cloud:spring-cloud-starter-config'
testCompile 'junit:junit'
testCompile 'org.springframework.boot:spring-boot-starter-test'
testCompileOnly 'org.projectlombok:lombok'
compile 'net.logstash.logback:logstash-logback-encoder'
}
Commons Library build.gradle
apply from: new File(project(':buildscripts').projectDir, '/repositories.gradle') // Repository definitions
apply from: new File(project(':buildscripts').projectDir, '/dm-plain.gradle') // DM via spring boot plugin
apply from: new File(project(':buildscripts').projectDir, '/dm-versions.gradle') // DM versions
dependencies {
api 'com.restfb:restfb:2.3.0'
api 'commons-io:commons-io'
implementation 'com.jcraft:jsch:0.1.54'
//lombok
compileOnly 'org.projectlombok:lombok'
//spring
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-jetty'
implementation 'org.springframework.boot:spring-boot-starter-security'
api 'org.springframework.security:spring-security-core'
api 'org.springframework.security:spring-security-web'
api 'org.springframework:spring-jdbc'
api 'org.springframework.boot:spring-boot-starter-actuator'
//thrift modules
compileOnly 'com.facebook.swift:swift-codec'
compileOnly 'com.facebook.swift:swift-service'
//db modules
api 'org.postgresql:postgresql'
api 'org.flywaydb:flyway-core'
api 'com.zaxxer:HikariCP'
api 'org.jooq:jooq'
//embedded pg modules
compileOnly 'com.opentable.components:otj-pg-embedded'
api group: 'net.minidev', name: 'json-smart', version: '2.2.1'
api group: 'org.json', name: 'json', version: '20140107'
//tests
testImplementation 'junit:junit'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'com.opentable.components:otj-pg-embedded'
testImplementation 'org.springframework.security:spring-security-core'
testImplementation 'org.springframework.security:spring-security-web'
testImplementation 'org.springframework.security:spring-security-config'
testImplementation 'org.springframework:spring-jdbc'
testImplementation 'org.springframework.boot:spring-boot-starter-actuator'
testImplementation 'org.apache.sshd:sshd-core:1.7.0' // sftpFileTransfer testing - embedded sftp server
testCompileOnly 'org.projectlombok:lombok'
testCompileOnly 'javax.servlet:javax.servlet-api'
}
Messaging Lib build.gradle (used as a standalone lib, hence does not use the above .gradle files)
buildscript {
ext {
springBootVersion = '2.1.3.RELEASE'
}
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}
apply from: new File(rootDir.parentFile, 'buildscripts/publish.gradle')
apply from: new File(rootDir.parentFile, 'buildscripts/coverage.gradle')
apply plugin: 'java'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
group = 'com.app.libs.messaging'
version = '0.0.3'
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
mavenCentral()
maven { url "https://repo.spring.io/snapshot" }
maven { url "https://repo.spring.io/milestone" }
}
ext {
springCloudVersion = 'Greenwich.SR1'
jacksonVersion = '2.9.6'
lombokVersion = '1.16.18'
jooqVersion = '3.11.2'
flywayVersion = '5.2.1'
}
dependencies {
compile 'org.aspectj:aspectjweaver'
compile 'org.springframework:spring-tx'
compile 'org.springframework.cloud:spring-cloud-stream'
compile 'org.springframework.cloud:spring-cloud-stream-binder-kafka'
compile 'org.apache.commons:commons-lang3:3.5'
compile 'org.javassist:javassist:3.22.0-GA'
compile "org.flywaydb:flyway-core:${flywayVersion}"
compileOnly "org.jooq:jooq:${jooqVersion}"
compileOnly "org.projectlombok:lombok:${lombokVersion}"
testCompileOnly "org.projectlombok:lombok:${lombokVersion}"
testCompile 'org.springframework.boot:spring-boot-starter-test'
testCompile 'org.springframework.boot:spring-boot-starter-json'
testCompile 'org.springframework.cloud:spring-cloud-stream-test-support'
testCompile "com.fasterxml.jackson.core:jackson-core:${jacksonVersion}"
testCompile "com.fasterxml.jackson.core:jackson-databind:${jacksonVersion}"
testCompile 'junit:junit:4.12'
testCompile "org.jooq:jooq:${jooqVersion}"
testCompile "org.flywaydb:flyway-core:${flywayVersion}"
testCompile 'org.postgresql:postgresql:42.2.2'
testCompile 'com.opentable.components:otj-pg-embedded:0.13.0'
testCompile 'org.springframework:spring-jdbc'
}
dependencyManagement {
// disable maven exclusion to enhance gradle import performance
// https://github.com/spring-gradle-plugins/dependency-management-plugin/issues/153
applyMavenExclusions = false
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
}
}
jar.enabled = true
bootJar.enabled = false
I've tried to omit any files that I think should be unrelated.

Resources