Search code examples
grails

best way to create a grails 3 app for web


I have previously used "grails create-app myapp" and the resultant application has web built in - e.g. I can scaffold or modify my views.

I see that there are various profiles, including "web". Web has various features. What is not clear is what the consequence of adding or not adding features, and why "web" is different from no profile.

Web profile features are:

Provided Features:

  • asset-pipeline - Adds Asset Pipeline to a Grails project
  • events - Adds support for the Grails EventBus abstraction
  • geb - Adds Geb 1.1.1 and WebDriver 2.47.1 to run functional tests
  • geb2 - Adds Geb 2, WebDriver 3.6.0 and Webdriver binaries Gradle Plugin dependencies to run functional tests. Requires JDK8.
  • gsp - Adds support for GSP to the project
  • hibernate4 - Adds GORM for Hibernate 4 to the project
  • hibernate5 - Adds GORM for Hibernate 5 to the project
  • json-views - Adds support for JSON Views to the project
  • less-asset-pipeline - Adds LESS Transpiler Asset Pipeline to a Grails project
  • markup-views - Adds support for Markup Views to the project
  • mongodb - Adds GORM for MongoDB to the project
  • neo4j - Adds GORM for Neo4j to the project
  • rx-mongodb - Adds RxGORM for MongoDB to the project

The confusing thing is whether I select web profile or not, and select hibernateX or not, I get hibernate anyway.

I know I dont need mongodb, neo4, rx-mongodb, geb, geb2, but surely everyone needs asset-pipeline etc. Should I chose json-views, hibernate5, gsp etc? If I forget to add these, how can they be added later?


Solution

  • Does not matter what the default generated build.gradle file contains, you can remove the items you don't need straight away.

    So, you should pick

    • asset-pipeline
    • gsp
    • hibernate4/5

    and the web-profile.

    The same is true for adding new plug-ins or dependencies: you can do it any time later.

    You should strive to keep the dependencies at minimum, as they mihgt have internal (version) conflicts.