Gradle-plugins : how can i know Gradle supported plugins version - gradle

I am trying to install sonarqube plugin in my gradle project.
I am using
Gradle 3.5
Groovy: 2.4.10
Ant: Apache Ant(TM) version 1.9.6 compiled on June 29 2015
JVM: 1.8.0_171 (Oracle Corporation 25.171-b11)
OS: Linux 4.4.0-128-generic amd64
And in build.gradle I added:
plugins {
id "org.sonarqube" version "2.0.1"
}
I run gradle sonarqube command
I am getting error like this,
* What went wrong:
org.gradle.internal.jvm.Jvm.getRuntimeJar()Ljava/io/File;
* Try:
Run with --info or --debug option to get more log output.
* Exception is:
java.lang.NoSuchMethodError: org.gradle.internal.jvm.Jvm.getRuntimeJar()Ljava/io/File;
at org.sonarqube.gradle.SonarQubePlugin.getLibraries(SonarQubePlugin.java:363)
How can I know which version of sonarqube I should mention for Gradle 3.5?

Related

Gradle build fails with "org/eclipse/jgit/storage/file/FileRepositoryBuilder has been compiled by a more recent version of the Java"

Starting from today I cannot build my project anymore. There are no changes in it.
Looks like some Gradle dependency is recompiled with Java 11.
I'm using Java 8 and Gradle 4.10.
org/eclipse/jgit/storage/file/FileRepositoryBuilder has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
Does anyone have the same problem?
./gradlew --version
------------------------------------------------------------
Gradle 4.10.3
------------------------------------------------------------
Build time: 2018-12-05 00:50:54 UTC
Revision: e76905e3a1034e6f724566aeb985621347ff43bc
Kotlin DSL: 1.0-rc-6
Kotlin: 1.2.61
Groovy: 2.4.15
Ant: Apache Ant(TM) version 1.9.11 compiled on March 23 2018
JVM: 1.8.0_292 (Private Build 25.292-b10)
OS: Linux 4.15.0-142-generic amd64
echo $JAVA_HOME
/usr/lib/jvm/java-8-openjdk-amd64/
./gradlew clean
FAILURE: Build failed with an exception.
* What went wrong:
org/eclipse/jgit/storage/file/FileRepositoryBuilder has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
* 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 0s
I've changed the version of Gradle plug-in org.ajoberstar.grgit in build.gradle and it is working. The version before was 4.1.0. Now: 4.1.1
plugins {
id 'java'
id "org.ajoberstar.grgit" version "4.1.1"
}

Getting a Gradle verion error even thoughn I appear to have the correct version installed

I get this error when I run a Gradle build:
$ ./gradlew clean build
FAILURE: Build failed with an exception.
* Where:
Build file '/Users/paulcarron/Documents/Documents/Books/Learning Spring Boot 2/learning-spring-boot-2/build.gradle' line: 2
* What went wrong:
An exception occurred applying plugin request [id: 'org.springframework.boot', version: '2.3.1.RELEASE']
> Failed to apply plugin [id 'org.springframework.boot']
> Spring Boot plugin requires Gradle 5 (5.6.x only) or Gradle 6 (6.3 or later). The current version is Gradle 6.0.1
* 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 759ms
I have Gradne 6.5 installed though:
$ gradle -v
------------------------------------------------------------
Gradle 6.5
------------------------------------------------------------
Build time: 2020-06-02 20:46:21 UTC
Revision: a27f41e4ae5e8a41ab9b19f8dd6d86d7b384dad4
Kotlin: 1.3.72
Groovy: 2.5.11
Ant: Apache Ant(TM) version 1.10.7 compiled on September 1 2019
JVM: 1.8.0_121 (Oracle Corporation 25.121-b13)
OS: Mac OS X 10.15.5 x86_64
What could the problem be here?
Just to nuance the correct answer in the comments.
The program gradle, if you have it, invokes Gradle installed on your system. It's likely found from your PATH variable.
The gradlew script (notice the 'w') is a wrapper script that is usually added to the Git repository. It invokes a declared version of Gradle, automatically downloading it beforehand if necessary. It uses its own installation folder (by default ~/.gradle/wrapper) and the version is declared in [repo]/gradle/wrapper/gradle-wrapper.properties).
While you can change the version by hand, it is better to run ./gradle wrapper --gradle-version 6.5 --distribution-type all as this will also update the wrapper script itself if needed.

Gradle JVM Version vs JDK

I want to use JDK11 in Gradle for compiling my project without modifying JDK_HOME, which points to JDK10. I'm using JDK10 for most projects, but testing an upgrade to JDK11 in Gradle.
JAVA_HOME=C:\Program Files\Java\jdk-10.0.2
In /.gradle/gradle.properties I set the following property:
org.gradle.java.home=C:/Program Files/Java/jdk-11.0.3
when I run the command: gradle properties, I see the following line:
org.gradle.java.home: C:/Program Files/Java/jdk-11.0.3
but when I run the command: gradle -version, I see this, showing JVM is version 10:
------------------------------------------------------------
Gradle 5.4.1
------------------------------------------------------------
Build time: 2019-04-26 08:14:42 UTC
Revision: 261d171646b36a6a28d5a19a69676cd098a4c19d
Kotlin: 1.3.21
Groovy: 2.5.4
Ant: Apache Ant(TM) version 1.9.13 compiled on July 10 2018
JVM: 10.0.2 ("Oracle Corporation" 10.0.2+13)
OS: Windows 10 10.0 amd64
Despite is saying JDK10 above, is it still compiling in JDK11 and JVM only means the Java version used to run the Gradle Daemon?
The version reported by gradle -version is the one of the client VM executing that command.
Normally, Gradle will otherwise use a daemon process to execute your build. That process will respect the org.gradle.java.home setting.
Note that you can also have a finer control on which Java executable is used for the different tasks in Gradle. See the documentation for details.

IDEA reports errors in build.gradle.kts while command line gradle run succeeds

I am using Kotlin DSL with Gradle build tool.
My gradle build works well both locally and on jenkins server when run from command line.
However IDEA complains and marks several items red with the following errors:
Cannot access class 'java.lang.Object'. Check your module classpath for missing or conflicting dependencies
None of the following functions can be called with the arguments supplied
I have tried all 3 options in project settings:
- Use default gradle wrapper
- Use gradle 'wrapper' task configuration
- Use local gradle distribuition
Result if pretty same
QUESTION: is something wrong in config, or is there a fix or workaround for that?
IntelliJ IDEA 2018.1.2 (Community Edition)
Build #IC-181.4668.68, built on April 24, 2018
JRE: 1.8.0_152-release-1136-b29 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Linux 4.15.0-20-generic
.
Kotlin plugin: 1.2.41-release-IJ2018.1-1
.
Gradle 4.7
------------------------------------------------------------
Build time: 2018-04-18 09:09:12 UTC Revision: b9a962bf70638332300e7f810689cb2febbd4a6c
Groovy: 2.4.12 Ant: Apache Ant(TM) version 1.9.9 compiled on February 2 2017 JVM: 1.8.0_171 (Oracle Corporation 25.171-b11) OS: Linux 4.15.0-20-generic amd64
UPD: #tweitzel you are right, it was incorrect SDK setting, thanks!
in my case I had set a jdk as File->Project Structure... -> Project->Project SDK
instead of setting the Kotlin SDK
after setting Kotlin SDK as Project SDK my build.gradle.kts errors disappeared

Unable to add gradle wrapper task to old project due to, version too old error

I need assistance to add a wrapper to an old gradle (v2.12) project, but I'm unable to run the wrapper tasks due to the following error:
Failed to apply plugin [class 'fi.jasoft.plugin.GradleVaadinPlugin']
Your gradle version (4.2.1) is too old. Plugin requires Gradle 2.0+
According to the error, I need to upgrade my gradle version, yet I have version 4.2.1 installed locally. Is there anyway to run the wrapper task with a specific version?
Gradle 4.2.1
Build time: 2017-10-02 15:36:21 UTC
Revision: a88ebd6be7840c2e59ae4782eb0f27fbe3405ddf
Groovy: 2.4.12
Ant: Apache Ant(TM) version 1.9.6 compiled on June 29 2015
JVM: 1.8.0_40 (Oracle Corporation 25.40-b25)
OS: Mac OS X 10.12.6 x86_64
Edit:
Tried using --gradle-version
| => gradle wrapper --gradle-version 2.12
Configure project :
Root version lmichelson
The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.
at build_an2u3e8kk42wdypa8wwdzfqcs$_run_closure6.doCall(/projects/maia/build.gradle:240)
(Run with --stacktrace to get the full stack trace of this deprecation warning.)
FAILURE: Build failed with an exception.
Where:
Script '/projects/maia/webapp/vaadin.plugin.0.10.7' line: 79
What went wrong:
A problem occurred evaluating script.
Failed to apply plugin [class 'fi.jasoft.plugin.GradleVaadinPlugin']
Your gradle version (4.2.1) is too old. Plugin requires Gradle 2.0+
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Get more help at https://help.gradle.org
BUILD FAILED in 2s
Thanks to the link and answer from #Opal, I solved the issue by
Installing SDKMAN
Downgrading my local gradle version to 2.12: sdk install gradle 2.12
Run the wrapper command
Restore my local version to 4.2.1: sdk install gradle 4.2.1

Resources