Debug Gradle application with instrumented files - eclipse

I have Eclipse Neon 4.6.2 and Gradle 4.3 installed locally. My goal is to build and debug a desktop gradle application written in Java.
In command line, to execute the application I have to run gradle clean build --no-daemon to generate instrumented class files. After that, I successfully execute the application.
I've tried doing the same in Eclipse because I need to run it with the debugger, so I've installed the Gradle plugin for Eclipse and launched clean build task with --no-daemon in program arguments section, but I´m getting this error:
I have no idea why isn't being recognized --no-daemon option which is one of the arguments of gradle build task.
After doing that, I would have to debug it as normal Java application?
Thank you!

You cannot run Gradle inside IDE without using daemon.
See https://docs.gradle.org/current/userguide/gradle_daemon.html#sec:tools_and_ides
The Gradle Tooling API (see Chapter 14, Embedding Gradle using the Tooling API), that is used by IDEs and other tools to integrate with Gradle, always use the Gradle Daemon to execute builds. If you are executing Gradle builds from within you're IDE you are using the Gradle Daemon and do not need to enable it for your environment.

Related

eclipse gradle Could not run phased build action

I am trying to run some gradle project on windows using eclipse. it is rapid miner extension template. but eclipse keeps showing this error:
Could not run phased build action using connection to Gradle distribution 'https://services.gradle.org/distributions/gradle-7.1.1-bin.zip'.
com.google.common.util.concurrent.ExecutionError: java.lang.NoClassDefFoundError: org/gradle/api/internal/java/JavaLibrary
java.lang.NoClassDefFoundError: org/gradle/api/internal/java/JavaLibrary
org/gradle/api/internal/java/JavaLibrary
org.gradle.api.internal.java.JavaLibrary
i tried different gradle versions and different configs. but it keeps showing this error. i need to fix this.
What gradle task did you try to run?
The extension template is used to create new extensions for RapidMiner Studio.
A detailed guide how to use it is found here:
https://docs.rapidminer.com/latest/developers/extensions/
So your first step should be to adapt the build.gradle file and then run the initializeExtensionProject task.
Afterwards you can write your Java code to build a new RapidMiner operator for example and then run the installExtension task to install the new extension on your local version of RapidMiner Studio.

Create a new Gradle Project in Eclipse fails

Creating a new Gradle project fails with,
org.gradle.tooling.BuildException: Could not execute build using Gradle distribution 'https://services.gradle.org/distributions/gradle-6.3-bin.zip'.
If I click on finish then I see the problem - Could not run phased build action using Gradle distribution 'https://services.gradle.org/distributions/gradle-6.3-bin.zip'.
Could not determine the class-path for class org.gradle.tooling.internal.consumer.connection.InternalPhasedActionAdapter.
This seems to be the following, not yet fixed issue on macOS Big Sur:
Eclipse Buildship issue #1050: Could not run phased build action using Gradle distribution '.../gradle-6.7-bin.zip': Java home is different
You might comment and/or propose a patch there.

How to debug a Jhipster/Gradle project on Eclipse

On a Jhipster project, build with Gradle we have the "gradlew -Pdev" command to run the project on localhost.
But how to launch it since Eclipse (or other IDE), in order to get break points and debug it ?
Thank you

Eclipse gradle integration

Do eclipse project->build, project-build all, project->clean commands work with gradle projects? If they do, which gradle tasks do they invoke and where is console output.
Thank you!
--- Vadim
An eclipse project build/clean does normally use the integrated eclipse java compiler instead of gradle build system. So your build output is inside /bin folder. The eclipse internal build is very fast because of the eclipse delta compiler etc.
When you build your projects in gradle normally /build/** folders are used for gradle output results.
So you got "two worlds" / two output folders. This is important to understand when you are using console parallel with eclipse. Some gradle integrations for eclipse try to change this default behaviour and are adding special Builders to call gradle for build/clean etc. but - in my opinion - this will increase build time too much when your projects are growing bigger.
Instead of buildship you could also use EGradle IDE (https://marketplace.eclipse.org/content/egradle-ide).
Its lightweight, fast and compfortable. You can very simple call tasks in this eclipse integration for gradle. More information can be found at https://github.com/de-jcup/egradle/wiki/Help

Debugging a Gradle 1.12 dependency resolution issue

I am using Gradle 1.12 to build an Android library. The build script works fine and the artifacts are installed to both a Maven local repository and deployed (using an S3 wagon Gradle plugin) to a remote Maven repository. When these artifacts are referenced by a Gradle (1.12) build of a sample app using the Maven local repo, all works fine. When the remote repository is used, a Gradle dependency resolution error is reported [details on the error will be provided later].
To get more information about the problem in order to fix my script or file a bug report, I would like to do some debugging of Gradle 1.12 while the sample app build script runs. Eclipse would seem to have the debugger of choice but configuring Eclipse is the subject of this post.
Following advice on the Gradle forums, it is straightforward to configure Gradle startup options to suspend on startup and await a connection from a client debugger (Eclipse).
Configuring Eclipse to do this is proving difficult. At first glance, it would seem that one needs a Gradle plugin. Spring Source provides a recommended one. But this plugin appears to bury and use Gradle 1.10. Perhaps upgrading this plugin to use 1.12 is easy and an answer that details how to do this would be a great answer.
The critical pieces of the answer I am looking for will enable me to place breakpoints in Gradle classes and step through source code until I either find a bug or figure out what I might be doing incorrectly in my build script.
Alternative approaches, such as using Intellij or Android Studio would be good answers as well if accompanied by details and/or references that make it clear how to enable the Gradle debugging process.
Debugging Gradle works exactly the same as (remotely) debugging any other Java application. No Gradle plugin is needed for this. In a nutshell, you need to start a remote debugging session from an Eclipse project that has Gradle sources. One way to create such a project is to clone the Gradle GitHub repository and run gradlew eclipse.