Why is the Grails-Gradle plugin necessary? - grails

I am building my first Grails app and would like the build to be managed by Gradle. I see that there is a Grails-Gradle plugin and many online searches indicate that it is not possible to build a Grails app using Gradle without this plugin.
My question is: why? Why (specifically) is this plugin necessary in order for Gradle to be able to build a Grails app? What functionality does this plugin provide that is otherwise missing?

I don't know why you think it's impossible to build a Grails app without the plugin. It's possible to issue commands to the grails shell from Gradle without the plugin, but it's not very clean.
That's what this plugin does. It cleans up that process, and makes it much Groovier with a DSL. It also makes your Gradle script more portable to other projects and persons.
If you browse the source code you will see all the inner workings of the plugin and realize what it's setting up in your Gradle script. What it offers is a lot of access to Grails in a very standard and portable manner.

Related

Does Bazel work with Grails?

Bazel is a multi-language build tool from Google that acts as a replacement for things like Maven, Gradle, Make, etc. There are articles written on how to migrate from Gradle to Bazel, for instance. But I wonder if this tool works with Grails.
Grails is a web app framework that uses Gradle, but from what I've seen it's a bit more than that. For lack of a better term, Grails itself acts as a "wrapper" for common tasks such as building an app as a WAR or JAR file, running the app locally with different profiles, or scaffolding new files and features. Popular IDEs such as IntelliJ have Grails plugins available to run these Grails commands. So it seems to me like it's perhaps tightly coupled to the Gradle build script that backs it.
It also seems to me that just because Bazel says it supports Gradle projects doesn't necessarily imply that it supports Grails projects, because of all these reasons regarding Grails being more than just Gradle. But I wanted to ask the community if my assumptions are true, or if, in fact, people are already using Bazel as a substitute for Gradle inside Grails projects. Can it be done?
Bazel could in theory be used to build grails projects as it is fundamentally agnostic to the type of thing being built. That said, grails probably works well with gradle out of the box and you'd have to re-implement a number of things yourself again and probably is not worth the effort. If you are a large shop and have multiple other languages that you need to support however, it may be worth investing in the effort.
https://github.com/pubref/rules_maven supports using a gradle file to determine transitive maven dependencies if you want to investigate further.

Convert Maven Project to Jenkins

Is it possible to convert Maven Project to Jenkins (I want to convert all the project from Maven to Jenkins)
My organization does not want to use Maven any more. The project has to be completely in Jenkins.
Please let me know the process of converting the project.
Thank you.
As Krishnan said in the comments, Jenkins is not a build tool. Jenkins is a build server that is meant for invoking build tools like Maven. It doesn't replace build tools.
So your question of converting Maven to Jenkins doesn't really make sense, since they are doing different things. However, if you are for some reason unable to use Maven, you have some alternatives. Some I can think of:
Use Gradle
Use Ant (only recommended for simply structured projects with little to no dependencies)
Use command line calls with plain javac like this: How to compile and run a simple java file in jenkins on Windows (not recommended since you have to script everything a build tool does yourself)

Grails project with several inline plugins. How to run tests on the whole app at once?

I have a project with several inline plugin dependencies.
Is it possible to run tests that cover the whole app (including the plugins) from the project?
I am looking for a solution that doesn't involve publishing the plugins to a repository.
The end goal is to be able to get coverage (clover) on the whole app.
Right now I can do that using a gradle script which runs test-app on each inline plugin and afterwards in the project and in the end merges the coverage reports.
The problem with this approach is that one of the plugins is compiled many times, because it is a dependency of some of the other plugins and of the project.
Any ideas on how to improve the situation above?

Effective grails plugin development

This has been very upsetting for me up till now. Here is what I am trying to do:
IDE I'm using is Intellij IDEA.
Building a grails application.
Grails application specifies two dependencies on in house grails plugins also being developed in IntelliJ as separate grails plugin projects.
Now to make any changes to plugins, I update the source code in plugin projects and use mavan-install (Maven Publisher plugin) to deploy to local Maven repository.
I have to uninstall the plugin in core grails project. Delete the plugin cache from ivy and then run the core grails project which gets the latest copy of plugin from local maven repository.
What's the effective and ideal way to achieve this? A single change makes me do some 5 minutes of labour work to even test and run core application.
Any recommendations/ best practices?
Use inline plugins for this - see section "Specifying Plugin Locations" in http://grails.org/doc/latest/guide/12.%20Plug-ins.html#12.1%20Creating%20and%20Installing%20Plug-ins
By specifying the plugin project directory with grails.plugin.location.<plugin-name> as the location of the installed plugin, you can edit the real files and the changes will affect the test application, and there's no need to sync anything up.

Gradle vs. Gant

I'm working on a Linux/Apache/MySQL/Grails application and have the choice of build tools. I'm looking at Gradle or Gant. They look very similar to me, so I'm not sure what differentiates them.
What are the major differences between Gradle and Gant that would make me pick one over the other?
The main difference is that Gant is a build tool, while Gradle is a project management tool (from the dev/ops standpoint).
So Gradle, compared to Gant, comes "battery included", because it allows you to easily use plugins, manage dependencies, has a complete, hookable, lifecycle, etc...
It is a bit like comparing Ant and Maven, stricly looking on the Java side.
The major reasons you would likely pick Gradle over Gant:
The functionality of Gant is a subset of Gradle. (basically a groovy wrapper around ANT)
Gant is built with Gradle
Beyond that Gradle has a plugin architecture, is DSL based, integrates with Maven and Ivy and has true incremental builds. Gant was a valuable innovation in its time, the lessons of which are in Gradle.
Grails already comes with a build system included, so you don't need to do anything. At the moment it is based on Gant scripts, but a switch to Gradle is on the roadmap for Grails 2.0.

Resources