Reputation: 191
I've heard you should type command
grails war
to build your project. I've thought to this point that Gradle is responsible for building the app in Grails. I've been doing the latter with conviction that my app is built. So what's the difference between
grails war
and
gradle build
?
Is it just that grails war is gradle build + create the war file?
Upvotes: 2
Views: 2170
Reputation: 14503
It is not that simple to compare Grails and Gradle. Gradle is a build tool, while Grails is a web application framework.
However, Grails provides a command line tool, that's described in the docs:
Grails incorporates the powerful build system Gant, which is a Groovy wrapper around Apache Ant.
So, Grails does not use Gradle.
The basic usage of the grails
command looks the following:
grails [environment]* [command name]
Where especially the command name parameter must be one out of predefined values. You can find the documentation on the war
command here.
The basic usage of the gradle
command looks the following:
gradle [option...] [task...]
The listed task parameters can be names of tasks created either in the build.gradle
script or by plugins. All mentioned tasks and their respective task dependencies will be executed. If you use the Gradle War Plugin, it will generate a war
task, which will also (transitively) be added as a task dependency of the build
task. So whenever you call gradle build
, a WAR file will be created. You can also call this task directly via gradle war
.
I just learned that Grails can or even does use Gradle beginning at a certain version. I even found a list on which Grails command calls which Gradle task. According to this list, calling grails war
is equivalent to calling gradle assemble
. The assemble
task directly depends on the war
task.
Upvotes: 3
Reputation: 846
gradle build
is a Gradle lifecycle task which usually consists of other tasks required to build a software like compileJava
and other lifecycle tasks like assemble
and check
.
In case of Grails it delegates build to Gradle and to war
task and it doesn't include check lifecycle during which unit tests will be executed.
Upvotes: 1