How do I change the Gradle version the Eclipse SpringSource plugin uses? - java

Note this is for the SpringSource plugin.
When I try to import a Gradle project in Eclipse I am getting the following error:
Project location doesn't exist; See error log for details.
The stacktrace error is basically this:
Caused by: java.lang.IllegalArgumentException: Project location doesn't exist
I did some research, and a Gradle defect (https://issuetracker.springsource.com/browse/STS-3158) mentions that error handling was improved with a more useful error message, including the project location.
I have Gradle 1.7 now on my machine; however Eclipse/Springsource keeps using Gradle 1.2. How do I get it to use 1.7 (or even 1.8)

I recommend to check "Preferences->Gradle->Use Gradle wrapper's default" and install the Gradle Wrapper for all builds in question. Then Eclipse will automatically pick the right Gradle version for each build (and nobody has to install Gradle manually).

Related

Gradle sync failed: Unable to make field private static final java.util.Map java.lang.ProcessEnvironment.theCaseInsensitiveEnvironment accessible

I try to build my gradle project and I get the following error:
1:36 PM Gradle sync failed: Unable to make field private static final java.util.Map java.lang.ProcessEnvironment.theCaseInsensitiveEnvironment accessible: module java.base does not "opens java.lang" to unnamed module #7d417077 (5 s 556 ms)
build.gradle file
and no, I do not know gradle and no I am not planning on learning it, but I have no chioce. Thanks in advance
I've had a similar problem with an old BungeeCord plugin, which used Gradle 4.10. In my case - it seems like that old Gradle doesn't work properly with Java 16, so I've manually changed contents of gradle/wrapper/gradle-wrapper.properties file to use Gradle 7.0.
Old file:
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10-bin.zip
New file:
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-bin.zip
Now it works ok, no more Gradle errors.
It seems like it can be cause by different things.
I solved it changing the JDK to the embedded android JDK and adding it to the path and JAVA_HOME environement variables.
I got this error in IntellJ when opening an Android project that someone sent me. It's a Gradle error and I'm not sure of the root cause. I think it's no Gradle JVM set in the .idea folder of whoever sent me the project.
My fix was explicitly set the Gradle JVM in IntelliJ in File -> Settings -> Build, Execution & Development -> Build Tools -> Gradle and set it to 11, or whatever. It's the same fix as another answer from me over here
I faced the same error while using a download project. Here the problem is with the version compatibility of Java and Gradle. The project was using Gradle 4.10.1 and my Gradle JDK was 17 which caused the error, I just changed my Gradle JDK to version 11. This solved the error for me.
Solution:
Go to File -> Project Structure -> Project. and note your Gradle Version. Gradle Version
Now go to this link: Compatibility Matrix - Gradle User Manual and look for a close enough Java version. Compatibility Matrix
Now go to File -> Settings -> Build, Execution, Deployment -> Build Tools -> Gradle. Under Gradle JDK click Download JDK.Gradle JDK
Select the version and Download then Apply. Select Download
Rebuild the Project now.

Importing a Gradle project in IntelliJ using different java jdk version

I tried to import a gradle project in IntelliJ and I'm getting the following error :
Error:Could not determine java version from '9.0.4'.
As said is the gradle project in java 1.8 ( exactly 1.8.0_152) and the version on my Linux is 9.0.4.
I think I should downgrade the version from 9.0.4 to this 1.8.0_152 but I don't know how to do it.
Can I fix the problem without downgrading the Java version ?
This is a well known bug! Here you can find the issue documentation with a possible solution on github: #16536
Edit the file /android/gradle/wrapper/gradle-wrapper.properties and update the last line with:
distributionUrl=https\://services.gradle.org/distributions/gradle-4.3-rc-2-all.zip
Alternate I found this intellij specific solution, solved by pointing intellij at a location of a custom gradle install:
"File > Settings... > Build, Execution, Deployment > Gradle > Use local gradle distribution"

Gradle exception while building GraniteDS project

Good day, everyone.
I'm trying to build GraniteDS project locally: https://github.com/graniteds/graniteds
but when I try to build it I'm facing:
org.gradle.api.GradleScriptException: A problem occurred evaluating root project 'graniteds-master'.
at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:76)
at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl$1.run(DefaultScriptPluginFactory.java:148)
at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.apply(DefaultScriptPluginFactory.java:156)
at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
Caused by: java.lang.NoClassDefFoundError: org.gradle.internal.nativeplatform.filesystem.FileSystems
at org.gradlefx.conventions.GradleFxConvention.class$(GradleFxConvention.groovy)
at org.gradlefx.conventions.GradleFxConvention.$get$$class$org$gradle$internal$nativeplatform$filesystem$FileSystems(GradleFxConvention.groovy)
I can find this class: org.gradle.internal.nativeplatform.filesystem.FileSystems
in GRADLE_HOME/lib/gradle-native-2.4.jar
Does anyone know why that can happen?
I'm guessing you have installed gradle on your machine and are building using the gradle command. The preferred way of using gradle is not to install it on your machine explicitly, and instead include the gradle wrapper in your source which lazily downloads a specific gradle version.
I note that the project has included a gradle wrapper (gradlew.bat) and I'm guessing that the version is different from that installed in GRADLE_HOME on your machine.
Try using the supplied gradle wrapper instead which just means typing gradlew instead of gradle.

Sonar maven plugin failing after upgrade to version 4.3.2

I upgraded my sonar version from 3.7 to 4.3.2. I understand from the release notes that alerts have been replaced with quality gates concept and when I log in to the dashboard, I do not see any quality profile that I had created before. I created a quality gate and set that as the default one.
On executing sonar from maven using sonar maven plugin, I get the following error - You must install a plugin that supports the language 'java'. I use the jacoco plugin to get multi module code coverage.
Is there any change that I need to do in my POM to get it running again?
This error occurs when installed plugins (directory extensions/plugins) are not copied before upgrading. Error logs will be improved in next versions.

Eclipse build errors when using Gradle or Maven?

When using a build manager like Gradle or Maven, my dependencies are being managed correctly, however the Eclipse IDE is unaware of the resolved dependencies so it will still show errors and I cannot build through Eclipse, I have to run a 'build' command through the build manager.
How do you get Eclipse to be aware of the resolved dependencies taken care of by a build manager and running the app through the IDE?
You can generate Eclipse metadata using eclipse plugin distribute with Gradle - http://www.gradle.org/docs/current/userguide/eclipse_plugin.html - this will set up the project with its classpath.
Or install Gradle plugin for Eclipse developed by Pivotal folks.
The question is vague. Using m2e or Gradle plugin for Eclipse developed by Pivotal can lead you to different errors. You should ask exact question, sharing error that you got here on stackoverflow.

Categories

Resources