Hi, could you please refer me to some resources about what best practices is done concerning gradle? I am wondering should I use gradle eclipse plugin or not (use gradle as standalone tool)? Could somebody please explain how gradle eclipse plugin works? I am confused who does the building (gradle or eclipse?) How can I check this? Is there downside about using the gradle plugin (in a way it interferes the development)?
I’m going to guess by the context of your note that when you refer to the “gradle eclipse plugin”, you’re referring to the Eclipse plugin that supports Gradle. I believe it’s more logical to refer to this as the “Eclipse Gradle plugin”. There is also a “Gradle Eclipse plugin”, which is a plugin for Gradle that produces Eclipse artifacts in the build process.
You should build your Gradle scripts so that they can run on the command line, or in an automated fashion from a build server. This is the “standalone” mode that you refer to.
The Eclipse Gradle plugin is just an “assistant” that makes it easier to write and debug your Gradle script in Eclipse. You could technically edit and view your Gradle script as a plain file, without the Eclipse Gradle plugin.
If you have more specific questions, ask specific questions.
Hi, thanks for your reply. Yes, I meant Eclipse Gradle plugin. I am confused with the following: I install the plugin, than I create build scripts (build.gradle) for each of my existing multiproject app. When I alter some source code (e.g. some java class) and when I do CTRL+S (save changes) who is compiling and building the code: Gradle or Eclipse? Is there a way to check this? I would like to avoid the possibility of developer having to concern if he/she had build the code with gradle; since the eclipse builder is the one they use while developing an app. I am not sure if this has sense or not? What would be the desired workflow? I am wondering if I should use eclipse gradle plugin (convert all my existing projects to Gradle projects) or leave the existing projects as they are and commit to my repo just build.gradle files and wrapper, so the build will have to be done from command line and not from eclipse?
Well, concerning whether Gradle or Eclipse is building the code when you save changes to a Java source file, I’d say the answer is “Yes”. Eclipse uses its own incremental Java compiler on each Java source file, but the Eclipse Gradle plugin will also perform some action when it detects a change to a source file in the project, which will most likely run the build script. Eclipse typically writes its compiled classes to the “bin” folder, and the Gradle build will typically write to the “build” folder.
I’d say you should definitely use the Eclipse Gradle plugin for Gradle projects. You get some benefit from it. You’ll get even more benefit in the Eclipse Mars release, when the Eclipse Gradle plugin will be significantly enhanced (I don’t know what the actual feature set or changes will be).
I’d say you also shouldn’t depend fully on the Eclipse plugin. Doing command line builds are essential, to verify your build is independent of your development environment. Your project and team will have to determine your specific practices.