I'm currently trying to set up a Gradle project in the Eclipse IDE, with JDK 19, Gradle 7.6, and Buildship, on a fresh install of the Eclipse IDE. When I try and create a new gradle project from the "new -> project..." dialog, the gradle build wizard pops up, but after creating the project it only creates a folder with no files in it -- no build.gradle, no Java library, nothing. I've tried making a regular Java project, and that works, so it seems to be something specifically wrong with either my Gradle or Buildship installation, but I have no idea what it could be. I've tried doing a fresh install of both Buildship and Gradle 7.6, and it doesn't seem to help.
The only thing I have to go on is that there seems to be issues connecting to the Gradle build. One of the errors from the error log is shown below:
org.gradle.tooling.GradleConnectionException: Could not execute build using connection to Gradle distribution 'https://services.gradle.org/distributions/gradle-7.4.2-bin.zip'.
at org.gradle.tooling.internal.consumer.ExceptionTransformer.transform(ExceptionTransformer.java:55)
at org.gradle.tooling.internal.consumer.ExceptionTransformer.transform(ExceptionTransformer.java:29)
at org.gradle.tooling.internal.consumer.ResultHandlerAdapter.onFailure(ResultHandlerAdapter.java:43)
at org.gradle.tooling.internal.consumer.async.DefaultAsyncConsumerActionExecutor$1$1.run(DefaultAsyncConsumerActionExecutor.java:69)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
at java.base/java.lang.Thread.run(Thread.java:1589)
at org.gradle.tooling.internal.consumer.BlockingResultHandler.getResult(BlockingResultHandler.java:46)
at org.gradle.tooling.internal.consumer.DefaultBuildLauncher.run(DefaultBuildLauncher.java:83)
at org.eclipse.buildship.core.internal.workspace.InitializeNewProjectOperation.initProjectIfNotExists(InitializeNewProjectOperation.java:60)
at org.eclipse.buildship.core.internal.workspace.InitializeNewProjectOperation.runInToolingApi(InitializeNewProjectOperation.java:45)
at org.eclipse.buildship.core.internal.operation.DefaultToolingApiOperationManager$WorkspaceRunnableAdapter.run(DefaultToolingApiOperationManager.java:58)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2380)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2405)
at org.eclipse.buildship.core.internal.operation.DefaultToolingApiOperationManager.run(DefaultToolingApiOperationManager.java:39)
at org.eclipse.buildship.core.internal.operation.DefaultToolingApiOperationManager.run(DefaultToolingApiOperationManager.java:33)
at org.eclipse.buildship.ui.internal.wizard.project.ProjectImportWizardController$5.run(ProjectImportWizardController.java:208)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:122)
Caused by: org.gradle.internal.jvm.JavaHomeException: The supplied javaHome seems to be invalid. I cannot find the java executable. Tried location: C:\Program Files\Java\jdk-19\bin\java.exe
at org.gradle.internal.jvm.Jvm.findExecutable(Jvm.java:183)
at org.gradle.internal.jvm.Jvm.getJavaExecutable(Jvm.java:208)
at org.gradle.internal.jvm.Jvm.forHome(Jvm.java:119)
at org.gradle.launcher.daemon.context.DaemonCompatibilitySpec.javaHomeMatches(DaemonCompatibilitySpec.java:64)
at org.gradle.launcher.daemon.context.DaemonCompatibilitySpec.whyUnsatisfied(DaemonCompatibilitySpec.java:40)
at org.gradle.launcher.daemon.context.DaemonCompatibilitySpec.isSatisfiedBy(DaemonCompatibilitySpec.java:35)
at org.gradle.launcher.daemon.context.DaemonCompatibilitySpec.isSatisfiedBy(DaemonCompatibilitySpec.java:25)
at org.gradle.launcher.daemon.client.DefaultDaemonConnector.getCompatibleDaemons(DefaultDaemonConnector.java:192)
at org.gradle.launcher.daemon.client.DefaultDaemonConnector.connectToIdleDaemon(DefaultDaemonConnector.java:157)
at org.gradle.launcher.daemon.client.DefaultDaemonConnector.connect(DefaultDaemonConnector.java:125)
at org.gradle.launcher.daemon.client.DaemonClient.execute(DaemonClient.java:145)
at org.gradle.launcher.daemon.client.DaemonClient.execute(DaemonClient.java:99)
at org.gradle.tooling.internal.provider.DaemonBuildActionExecuter.execute(DaemonBuildActionExecuter.java:44)
at org.gradle.tooling.internal.provider.DaemonBuildActionExecuter.execute(DaemonBuildActionExecuter.java:30)
at org.gradle.tooling.internal.provider.LoggingBridgingBuildActionExecuter.execute(LoggingBridgingBuildActionExecuter.java:60)
at org.gradle.tooling.internal.provider.LoggingBridgingBuildActionExecuter.execute(LoggingBridgingBuildActionExecuter.java:37)
at org.gradle.tooling.internal.provider.ProviderConnection.run(ProviderConnection.java:222)
at org.gradle.tooling.internal.provider.ProviderConnection.run(ProviderConnection.java:148)
at org.gradle.tooling.internal.provider.DefaultConnection.getModel(DefaultConnection.java:202)
at org.gradle.tooling.internal.consumer.connection.CancellableModelBuilderBackedModelProducer.produceModel(CancellableModelBuilderBackedModelProducer.java:54)
at org.gradle.tooling.internal.consumer.connection.PluginClasspathInjectionSupportedCheckModelProducer.produceModel(PluginClasspathInjectionSupportedCheckModelProducer.java:38)
at org.gradle.tooling.internal.consumer.connection.AbstractConsumerConnection.run(AbstractConsumerConnection.java:64)
at org.gradle.tooling.internal.consumer.connection.ParameterValidatingConsumerConnection.run(ParameterValidatingConsumerConnection.java:49)
at org.gradle.tooling.internal.consumer.DefaultBuildLauncher$1.run(DefaultBuildLauncher.java:97)
at org.gradle.tooling.internal.consumer.DefaultBuildLauncher$1.run(DefaultBuildLauncher.java:89)
at org.gradle.tooling.internal.consumer.connection.LazyConsumerActionExecutor.run(LazyConsumerActionExecutor.java:143)
at org.gradle.tooling.internal.consumer.connection.CancellableConsumerActionExecutor.run(CancellableConsumerActionExecutor.java:45)
at org.gradle.tooling.internal.consumer.connection.ProgressLoggingConsumerActionExecutor.run(ProgressLoggingConsumerActionExecutor.java:61)
at org.gradle.tooling.internal.consumer.connection.RethrowingErrorsConsumerActionExecutor.run(RethrowingErrorsConsumerActionExecutor.java:38)
at org.gradle.tooling.internal.consumer.async.DefaultAsyncConsumerActionExecutor$1$1.run(DefaultAsyncConsumerActionExecutor.java:67)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
So my best guess is that my Java Home is wrong, but all the documentation I can find online says it's set right. So I have no idea how to fix this.
I use my own build tool in cdt eclipse. It builds the target files and writes some build information to the console window.
For the indexer I only enables the cdt gcc Output parser, and my expectations is that all the information for the include path and dependencies are getting from the build output.
Unfortunately the parser seems not to work correctly. It could not resolve the dependencies. I tried several times to rebuild the indexer
I tried it with the default Compiler command pattern: *(g?cc)|([gc]++)|(clang)
and for example I simplified log line to compile a single c-file is as follows:
INFO :: Command C:\target-gcc.exe -c- -IC:\Include1 -IC:\Include2.. C:\Projects\test.c -o C:\Projects\test.o
Using the the CDT GCC Build in Compiler Settings MinGw in principle works, but then I have some addtional errors in the Problems windows which I want to avoid.
I am trying to create a Scala-Maven project on IntelliJ. I had downloaded the plugin Scala. When I try to create a project from IntelliJ's file menu like below:
Once I click on NEXT and FINISH, I see the Idea tries to build the project and fails with this message:
"C:\Program Files\Java\jdk1.8.0_151\bin\java.exe" -Dmaven.multiModuleProjectDirectory=C:\Users\Bobby\AppData\Local\Temp\archetypetmp "-Dmaven.home=C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2018.1.4\plugins\maven\lib\maven3" "-Dclassworlds.conf=C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2018.1.4\plugins\maven\lib\maven3\bin\m2.conf" -Dfile.encoding=UTF-8 -classpath "C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2018.1.4\plugins\maven\lib\maven3\boot\plexus-classworlds-2.5.2.jar" org.codehaus.classworlds.Launcher -Didea.version=2018.1.4 -s C:\Users\Bobby\.m2\settings.xml -Dmaven.repo.local=C:\Users\Bobby\.m2\repository -DinteractiveMode=false -DgroupId=com.sample.programs -DartifactId=Abcd -Dversion=1.0-SNAPSHOT -DarchetypeGroupId=org.scala-tools.archetypes -DarchetypeArtifactId=scala-archetype-simple -DarchetypeVersion=1.2 -DarchetypeRepository=http://scala-tools.org/repo-releases org.apache.maven.plugins:maven-archetype-plugin:RELEASE:generate
[ERROR] Error executing Maven.
[ERROR] 1 problem was encountered while building the effective settings
[FATAL] Non-parseable settings C:\Users\Bobby\.m2\settings.xml: only whitespace content allowed before start tag and not x (position: START_DOCUMENT seen x... #1:1) # C:\Users\Bobby\.m2\settings.xml, line 1, column 1
[ERROR] Maven execution terminated abnormally (exit code 1)
I checked the maven folder in my desktop and these are the sub folders inside .m2/repository:
Could anyone let me know what is the problem here and what should I do to make this work ?
I tried to follow your exact steps but didn't get the same error. I'm using IntelliJ IDEA Community 2016.2 .
From the error message you received, it looks like you might have a corrupted .m2\settings.xml.
I noticed that this file doesn't exist by default on my computer. I tried to create one with only the 'x' character, and that causes an error on my maven build (but not exactly the same as yours).
Try to check that file, and make sure it's content is xml formatted, or erase it completely (if you are sure it's safe).
There is a UI way to see that document in IntelliJ:
1. Open the Maven Project tab
2. Right click on your project title
Maven Project Tab
3. Select " Open 'settings.xml' "
opened settings.xml
4. The setting file content is displayed in your IDE and can be modified
Hope that helps
I am running Eclipse Luna on OS X with Gradle IDE 3.6.1 and anytime I try to select a project from the gradle tasks panel I get the following error:
org.eclipse.osgi.internal.framework.EquinoxConfiguration$1
Could not fetch model of type 'EclipseProject' using Gradle distribution
'https://services.gradle.org/distributions/gradle-2.0-bin.zip'.
Has anyone else run into this error? I can get to the URL specified to download the file myself. So, network connectivity shouldn't be the problem.
The problem is for the java version configured by default on the IDE (Eclipse or Spring Tool Suite). The error is the following:
To fix it, you can set the Java version supported by the Gradle version in Configure Workspace Setting option.
Finally, you can refresh your project o continue with your creation. Later all will be perfect.
I had the same error in Eclipse Neon (version numbers were different, but otherwise same error). It looks like several different things can cause this error, but for me it was an incorrect property in [MyProject]/.settings/org.eclipse.buildship.core.prefs.
I had
connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER)
but it needed to be
connection.gradle.distribution=GRADLE_DISTRIBUTION(VERSION(2.13))
2.13 should be replaced with whatever version number output you get from gradle -version.
Coming back to add this:
It turns out, the actual root problem was an incompatibility between Gradle versions. My build.gradle file worked fine with an old version of Gradle, but uses things that were deprecated and removed in later versions.
Solution is to click Finish immediately in the wizard instead of Next, and then fix the issues in the build.gradle.
Bad reference in config.
Overwrite configuration:
Project -> Properties -> Gradle -> Override workspace settings ->
Specific Gradle version -> 4.x
You need to update Gradle
Goto:
Select 'Help > About Eclipse' (on Macs this is 'Eclipse > About Eclipse').
Click the 'Installation Details' button to display the installation details dialog. Look in the 'Installed Software' tab to see all the installed plugins.
Search for Gradle(Eclipse Plug-ins for Gradle) and Update.
It might take some time for first time after that.
Reason why it happens, cause new version of gradle is available to download. Once you download new version of gradle, your error will go away.
http://gradle.org/downloads
I had the same error message using Eclipse 4.5
In my case the build file was having a error and I had to modify this line
eclipse.classpath {
plusConfigurations += configurations.providedCompile
}
into this
eclipse.classpath {
plusConfigurations += [configurations.providedCompile]
}
After that everything worked again.
I met the same problem, somebody suggested that the gradle project may be build by a old version.
I solve the problem by the following step:
modify the configuration in Eclipse, perfrence ->gradle ->gradle distribution . point it to an older version.
delete the file in ./gradle/wrapper
reload the program
In my case, I forgot to put ending apostrophe ' for a value
I ran into a similar issue recently - even blowing away the project and repulling a fresh copy from git didn't fix it. I realized it wasn't specific to the project when I reproduced it outside of Eclipse:
$ ./gradlew tasks
FAILURE: Build failed with an exception.
* What went wrong:
Expecting a stack map frame
Exception Details:
Location:
build_euvk0e0guiuwrf8fgn8svi2fy.run()Ljava/lang/Object; #16: aconst_null
Reason:
Error exists in the bytecode
Bytecode:
0x0000000: 2abb 0022 592a 2ab7 0025 ba00 3300 00b0
0x0000010: 01b0
What did fix it was removing the gradle cache:
$ rm -r ~/.gradle/caches
$ ./gradlew tasks
Somehow the version of gradle there had become corrupted (possibly related to Eclipse groovy plugin - I had this issue regularly until uninstalling it), and blowing it away forced it to get a fresh copy.
Hopefully this answer helps someone else avoid pulling out their hair.
I had a very similar issue and removing the following from my build.gradle fixed it. The same bit of config works in all other Gradle projects I have but for some reason not this one...
allprojects {
...
apply plugin: 'eclipse-wtp'
...
// remove this eclipse config to make the error go away
eclipse {
classpath { defaultOutputDir = file('build-eclipse') }
}
...
}
Open the CMD and enter there gradle --gui, change the settings of the gradle gui in the register Setup to Stack trace Output: Full Stack trace [-S] and the log level to info. Then change the current directory to the directory your build.gradle file is located and then go to the first register and let process the gui this files.
An error message should be displayed. There you find out what is wrong with your build.gradle file. In my case there was a folder missing and this causes this error.
This error can also be caused by a syntax error in the previous line of build.gradle. If so, the error has nothing to do with the Gradle or Eclipse version you are running. See this question
In my case i changed the Gradle version from 4.7.rc2 to4.6 and then it started to work.
I am on eclipse Oxygen (4.7.2), I was getting similar exception while importing the project and this worked for me:
While importing on windows Import Options
Click Configure Workspace Setting (which will take to preference window)
Select Local Installation directory (for me 'graddle wrapper' was selected)
apply, close and continue import
Below is the error I was getting
Loading Gradle project preview failed due to an error in the referenced Gradle build.
Could not fetch model of type 'GradleBuild' using Gradle distribution 'https://services.gradle.org/distributions/gradle-3.5-bin.zip'.
_BuildScript_
org.gradle.tooling.BuildException: Could not fetch model of type 'GradleBuild' using Gradle distribution 'https://services.gradle.org/distributions/gradle-3.5-bin.zip'.
at org.gradle.tooling.internal.consumer.ExceptionTransformer.transform(ExceptionTransformer.java:51)
at org.gradle.tooling.internal.consumer.ExceptionTransformer.transform(ExceptionTransformer.java:29)
at org.gradle.tooling.internal.consumer.ResultHandlerAdapter.onFailure(ResultHandlerAdapter.java:41)
at org.gradle.tooling.internal.consumer.async.DefaultAsyncConsumerActionExecutor$1$1.run(DefaultAsyncConsumerActionExecutor.java:57)
at Caused by: java.lang.ClassNotFoundException: _BuildScript_
at org.gradle.groovy.scripts.internal.DefaultScriptCompilationHandler$ScriptClassLoader.loadClass(DefaultScriptCompilationHandler.java:386)
... 77 more
None of the solutions worked for me and I'm having the same errors on STS 4 with eclipse Version: 2.2.600.v20190605-1800. My steps were:
Delete the project from my workspace
./gradlew cleanEclipseWtp cleanEclipse eclipseWtp eclipse
Import the project as an existing eclipse project (not an existing gradle import)
That worked!
Deleting .gradle folder from the project resolved my problem.
I got this error with Eclipse 2021-06, Java 1.8.0, gradle 4.4.
I tried deleting gradle wrapper binary folder, predefining gradle version, etc.
The thing that helped was just specifying gradle home directory and java home directory after selecting overriding workspace configuration.
Eclipse 4.4.1 broke Gradle Eclipse support with non-string values in system properties.This is fixed in the latest Gradle for the 3.6.2 release. Update your Gradle form this update-site: http://dist.springsource.com/snapshot/TOOLS/gradle/nightly
So in Windows in the comand line I wrote
set GRADLE_OPTS=-Xdebug
-Xrunjdwp:transport=dt_socket,address=9999,server=y,suspend=y
Then I get:
C:\Project>gradle main
Listening for transport dt_socket at address: 9999
Then I put a breakpoint in the gradle.build file
and at last from Eclipse IDE
And I get
why this happend? So I can't debug gradle files, I can only debug java,groovy.. files?
It's a known limitation that Gradle build scripts can't currently be debugged in IDEs. I'm not aware of the specific error though. Usually the debugger just doesn't stop at the breakpoint (but it will stop at breakpoints for user-defined plugin/task classes and Gradle classes).