Cannot get Spring Boot's buildInfo() to work when Artifactory Gradle plugin is used - gradle

Gradle: 2.13
Boot: 1.3.5
Artifactory Gradle Plugin (org.jfrog.buildinfo:build-info-extractor-gradle): 4.5.0
This project has been building for for some time. However, now I'm trying to get some additional build information to display via the /info endpoint so, per the docs, I added:
springBoot {
buildInfo()
}
Now there seems to be some sort of conflict with the Artifactory Gradle plugin:
Caused by: groovy.lang.GroovyRuntimeException: Could not find matching constructor for: org.jfrog.gradle.plugin.artifactory.dsl.DoubleDelegateWrapper(org.jfrog.build.extractor.clientConfiguration.ArtifactoryClientConfiguration$BuildInfoHandler)
at org.jfrog.gradle.plugin.artifactory.dsl.ArtifactoryPluginConvention.buildInfo(ArtifactoryPluginConvention.groovy:64)
at org.jfrog.gradle.plugin.artifactory.dsl.ArtifactoryPluginConvention.invokeMethod(ArtifactoryPluginConvention.groovy)
at org.gradle.api.internal.BeanDynamicObject$GroovyObjectAdapter.invokeMethod(BeanDynamicObject.java:279)
at org.gradle.api.internal.BeanDynamicObject.invokeMethod(BeanDynamicObject.java:130)
at org.gradle.api.internal.plugins.DefaultConvention$ExtensionsDynamicObject.invokeMethod(DefaultConvention.java:212)
at org.gradle.api.internal.CompositeDynamicObject.invokeMethod(CompositeDynamicObject.java:150)
at org.gradle.groovy.scripts.BasicScript.methodMissing(BasicScript.java:79)
at build_do1tse3u3lgd8dbntr9ir9lk6$_run_closure5.doCall(/Users/jbisotti/sandbox/fusion/fusion-eureka-service/build.gradle:76)
at org.gradle.api.internal.ClosureBackedAction.execute(ClosureBackedAction.java:67)
at org.gradle.api.internal.plugins.ExtensionsStorage$ExtensionHolder.configure(ExtensionsStorage.java:145)
at org.gradle.api.internal.plugins.ExtensionsStorage.configureExtension(ExtensionsStorage.java:69)
at org.gradle.api.internal.plugins.DefaultConvention$ExtensionsDynamicObject.invokeMethod(DefaultConvention.java:207)
at org.gradle.api.internal.CompositeDynamicObject.invokeMethod(CompositeDynamicObject.java:150)
at org.gradle.groovy.scripts.BasicScript.methodMissing(BasicScript.java:79)
at build_do1tse3u3lgd8dbntr9ir9lk6.run(/Users/jbisotti/sandbox/fusion/fusion-eureka-service/build.gradle:75)
at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:91)
... 50 more
I'm not sure which of the three suspects are at fault, nor how to fix it. Any help would be greatly appreciated!

Turns out buildInfo() was not added until Spring Boot 1.4.0. D'oh!

Related

Gradle: Could not resolve all files for configuration ':compileClasspath'

Gradle build is throwing the following error
What went wrong:
Execution failed for task ':compileJava'.
Could not resolve all files for configuration ':compileClasspath'.
Could not find com.oracle:ons:19.3.
Required by:
project :
project : > com.xyz.abc.utils:openshift-utils:2.0.30
I have added the below dependency
implementation('com.oracle:ons:19.3')
Also the below repository
mavenCentral()
maven { url 'http://repository.xyz.com:8081/artifactory/gradle-plugins'; allowInsecureProtocol true
metadataSources {
mavenPom()
artifact()
}
}
I can see this dependency under Project and External Dependencies
The project that is needing this dependency has the below line in build.gradle
compile("com.oracle:ons:19.3")
I'm using gradle wrapper and gradle version is 7.4.2
Can you please help in resolving this error?
I was also facing similar issue. This resolved for me when I used a compatible spring boot version for particular JAVA version you are using in your project.I was getting similar issue-
For example - version 3.0.0 is not compatible with JAVA 11
But when I used version 3.0.0 with JAVA 17 and rebuild the project, it was resolved

Is io.spring.dependency-management plugin required when using Spring Boot 2.3+ and Spring Cloud?

I'm using Gradle 6.6 to build my Spring Boot app. According to this post, the io.spring.dependency-management plugin is no longer needed since Gradle 5+ supports BOM files.
However, I receive the following error if I remove the plugin:
Could not run phased build action using connection to Gradle distribution 'https://services.gradle.org/distributions/gradle-6.6.1-bin.zip'.
Build file 'C:\my-app\build.gradle' line: 14
A problem occurred evaluating root project 'my-app'.
Could not find method dependencyManagement() for arguments [build_6e8ejdhnd2no2m9jw221sctmn3$_run_closure2#432e46e2] on root project 'my-app' of type org.gradle.api.Project.
Line 14 of my build.gradle file is referenced in the above error. Here are lines 14-18:
dependencyManagement {
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:Hoxton.SR8"
}
}
Is there another way to specify the required dependencies for Spring Cloud without using io.spring.dependency-management plugin?
dependencyManagement() is provided exclusively by the io.spring.dependency-management plugin. Which means you cannot use it if you don't use the plugin.
And in that case you have to use the gradle's platform capability.
In the post you linked there's an example of that.
To fix your build, remove the dependencyManagement part and add
implementation platform("org.springframework.cloud:spring-cloud-dependencies:Hoxton.SR8")
to your dependencies { }
Reference: https://docs.spring.io/dependency-management-plugin/docs/current/reference/html/#dependency-management-configuration-dsl

elasticsearch-rest-high-level-client dependency is not working

it's my first question.
I have to using ES rest high level client.
my ES server is 6.8.x, so i write my build.gradle file.
compile "org.elasticsearch.client:elasticsearch-rest-high-level-client:6.8.5"
but my project dependency works like below.
Gradle: org.elasticsearch.client:elasticsearch-rest-client:7.6.2
Gradle: org.elasticsearch.client:elasticsearch-rest-high-level-client:6.8.5
Gradle: org.elasticsearch.client:elasticsearch-rest-high-level-client:7.6.2
.. and more ...
why the wrong version 7.6.2 imported?
i got the answer myself.
the spring boot 2.3.x are using Elasticsearch 7.6.2 by dependency management(BOM).
https://docs.spring.io/spring-data/elasticsearch/docs/current/reference/html/#preface.versions
the answer is overriding the version in gradle.
ext['elasticsearch.version'] = '6.8.5'
be careful... this is not working.
ext {
elasticsearch.version = '6.8.5'
}
good!

bootRepackage classifier is not working when upgrade to gradle 6.6.1 (also gralde 5)

Our project still worked well in gradle 4.10.2 (Spring boot 1.5.22), but when i have upgraded gradle to 6.6.1 it thrown exception
org.gradle.api.ProjectConfigurationException: A problem occurred configuring project ':my-app'.
Caused by: org.gradle.internal.event.ListenerNotificationException: Failed to notify project evaluation listener
Caused by: java.lang.NoSuchMethodError: org.gradle.api.tasks.TaskInputs.file(Ljava/lang/Object;)Lorg/gradle/api/tasks/TaskInputs;
at org.springframework.boot.gradle.repackage.RepackagePluginFeatures$RegisterInputsOutputsAction.setupInputOutputs(RepackagePluginFeatures.java:150)
at org.springframework.boot.gradle.repackage.RepackagePluginFeatures$RegisterInputsOutputsAction.execute(RepackagePluginFeatures.java:136)
I have tried with gradle 5 it still happend.
This is my gradle.build bootRepackage section, when i removed classifier = "boot" it work without classifier feature
bootRepackage {
enabled = true
classifier = "boot"
doLast{
//some tasks
}
}
Why could this be?
Gradle 5 has removed a method that Spring Boot 1.5’s Gradle plugin requires. Spring Boot 1.5 supports Gradle 2.x or 3.x so it isn’t surprising that it does not work with Gradle 5.
If you want to use a more up-to-date version of Gradle, you’ll have to upgrade to a more up-to-date version of Spring Boot as well. At the time of writing 2.3.x is the oldest generation of Spring Boot that is still supported.

Spring boot gradle project with kotlin setup issue

Hello i want to create a Spring boot app with kotlin and Gradle but i have this issue in the plugins line, it doens't recognize any plugin i add ,i couldn't undrestand what's missing, i'm using Gradle 6.3v , jdk 8
Error:
Error
And that's the build.gradle file
build.gradle.kts
Your first plugin declaration has a typo in the version:
kotlin("jvm") version "1.3.11" needs to be kotlin("jvm") version "1.3.71"
I would start by changing that so all usages of kotlin plugins are aligned on a recent version.
If that does not resolve the problem, try running the build from the CLI with the added flag --stacktrace which may tell you more about why is the plugin not found.

Resources