Debugging a Gradle 1.12 dependency resolution issue - eclipse

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.

Related

How to make Android Studio and Eclipse coexist (gradle dependencies)

I need to use Eclipse and Android Studio on the same computer, simultaneously, for different projects.
The Eclipse project is Enterprise Java deploying on Payara (Glassfish) via the WTP toolkit and Deployment Assembly. When setting up the project I build with gradle build and gradle eclipse, which pulls all the required dependencies and configures the Deployment Assembly in Eclipse. However, I believe that any incremental code changes thereafter are compiled by Eclipse without using gradle (e.g., when I save a file).
Android Studio always compiles with gradle.
The issue that I have is that every couple of weeks, when I compile my Android Studio project, gradle decides to delete all my Eclipse project dependencies. My guess is that it thinks that they are not in use any more, since Eclipse compiles outside gradle. This results in my Eclipse workspace pointing to libs that are no longer there.
If I manually run gradle build in my Eclipse project dir, my dependencies are restored and Eclipse no longer complains. But something seems to be cached wrong somewhere so after this my web app will no longer deploy on the server. At that point my workspace is effectively corrupted and to this day I haven't found any workaround, other than to delete it and start all over again. Which is *A LOT* of work to reconfigure.
Any help will be greatly appreciated.

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.

Intellij IDEA doesn't see plugin module

I was trying to test some of open source plugins from here. But I can't run/debug any of them because Intellij IDEA doesn't see plugin module. It says: Run Configuration Error: No plugin module specified for configuration. I tried a lot of different tricks, but nothing worked.
I have not found a way to debug the plugin (I get that error for a plugin I am developing when I try to use the Plugin run configuration).
If you simply want to run the plugin, you can build the distribution XML file locally using the task provided by the plugin to do so. gradle tasks should list the available tasks. For my project (which uses gradle-intellij-plugin to provide IntelliJ plugin development integration in gradle), this task is:
gradle buildPlugin
You can then use the "Install plugin from disk..." option in the Settings > Plugin page of an IntelliJ instance.
The gradle-intellij-plugin integration also provides the:
gradle runIdea
task that starts a new IntelliJ instance in a sandboxed configuration with the plugin installed.

Creating gradle project in 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.

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.