Creating gradle project in eclipse - eclipse

I play with gradle support in STS. When I try to create a gradle project via eclipse gradle wizard, I get the following error:
Server returned HTTP response code: 502 for URL: http://downloads.gradle.org/distributions/gradle-1.0-rc-2-all.zip
Therefor, there are 2 questions from my side:
Why does gradle even try to download the distribution from remote
server if I have it locally installed?
Where shoud I indicate to
use local version of gradle distibution?
PS. My PC is under the proxy which prohibits downloading zip archives.

My best guess is that you chose "use Gradle wrapper" in the Gradle project import wizard. The downloads generally work fine, but might not work anymore for very old Gradle versions such as 1.0-rc-2. To solve this problem, you can either upgrade to a newer Gradle version, or point the wizard to a local Gradle installation.

Related

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.

Azure SF tutorial project builds with gradle 5.4, but not with Eclipse 2019-06

I am trying to follow the Microsoft Azure Tutorial: Create an application with a Java web API front-end service and a stateful back-end service on Service Fabric and it seems to build ok with gradle 5.4 on Windows 10:
However when opening the same directory with Eclipse 2019-06 (and ServiceFabric plugin) then the IDE displays the following 3 errors:
Missing Gradle project configuration folder: .settings
The project was not built since its build path is incomplete. Cannot find the class file for java.lang.Object. Fix the build path then try building this project
The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class files
What is please missing here? I feel that something basic, like JDK path is maybe missing (my JAVA_HOME env. variable is set though).
Since File > Open Projects from File System... does not yet detect Gradle projects (you can vote for this feature with a 👍 here), you must use File > Import...: Gradle > Existing Gradle Project to open a directory as Gradle project.

Run gradle Project in Eclipse

I am working with the Gradle build system in the Eclipse IDE. Whenever I create Gradle project in Java I always need to go to command prompt and then to specific project directory and build it first through command gradle build followed with the my corporate proxy settings. I am not able to build it directly from the IDE. can anyone suggest Where I can add my proxy setting to make it build and run my Gradle project from the Eclipse IDE directly rather than going to command prompt always.
Thanks in advance :-)
You can define the proxy settings in gradle.properties in your root project directory if it is the same for anyone using that repository, or in ~/.gradle/gradle.properties to set it for any Gradle project on your machine but not affecting other users of the repository.
See here for further information about the proper syntax.

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.

Gaelyk eclipse configuration error

I've tried to configure a gaelyk project in eclipse using the gradle script of the template project and always failed.
to do this I use the following command:
gradlew cleanEclipse eclipse
All the packeges seems correctly downloaded, the .project and .classpath files are created but I always fint this error on the project:
The App Engine SDK 'C:\Users\username\.gradle\caches\artifacts\com.google.appengine\appengine-api-1.0-sdk\c12498cf18507aa6433a94eb7d3e77d5\jars\appengine-api-1.0-sdk-1.6.1.jar' on the project's build path is not valid
(SDK location 'C:\Users\username\.gradle\caches\artifacts\com.google.appengine\appengine-api-1.0-sdk\c12498cf18507aa6433a94eb7d3e77d5\jars\appengine-api-1.0-sdk-1.6.1.jar' is not a directory)
It seems that the appengine SDK is specified uncorrectly in the .classpath/.project files.
I've installed eclipse Indigo and the last version of the google plugin for eclipse
How can I fix it?
I am personally not using Eclipse for Gaelyk development. Therefore, I am not sure if the existing Eclipse configuration in the Gradle build script of the template project will work with the Google plugin.
However, a while ago I got a pull request for the Gradle GAE plugin to integrate with the Eclipse plugin. I had turned it down because it's too specific and it would lead to potentially a lot of bugs to the Gradle plugin as the Google configuration might change. The author was planning to creating a separate plugin for it so you can try to ping him.
I also know of another Gradle plugin that might help you here. Also try to post your question the Gaelyk mailing list.