Grails Vue Profile

A profile for creating Grails applications with a Vue.js frontend

Version: 1.1.1.BUILD-SNAPSHOT

Table of Contents

1 Introduction


This profile provides support for building Grails applications with a Vue.js frontend. It includes a simple Vue app which renders the default Grails index page, and retrieves application metadata via a REST call to the Grails application. A simple unit test and an end-to-end (integration) test is included within the Vue project. The Vue project follows the conventions used in the Vue-CLI webpack template.

To create an application using the vue profile you can use the following command:

grails create-app myapp --profile=vue

You can also choose this profile when generating your project from the Grails Application Forge, either from the web app or via the API:

curl -O -d profile=vue

Grails Application Forge is a great way to discover the different provided features in the profile.

2 Usage

The Vue profile provides a client/server multi-project build structure. The "server" is a Grails app using the rest-api profile with CORS enabled. It can be started using grails run-app (from the server directory) or using the Gradle wrapper:

./gradlew server:bootRun

The Vue.js client app has been built using the Vue-CLI with the webpack template. It’s configured for both npm and yarn. and can be started via npm start or yarn start) (in which case you will need to run npm install or yarn to install project dependencies) or using the Gradle wrapper (which will install npm dependencies automatically if needed):

./gradlew client:start

The client app’s build.gradle defines other tasks to test and build the app using the scripts in client/package.json. Please see Vue-CLI’s documentation for more information.

The client/build.gradle file also provides a bootRun task to support running both client & server projects in parallel. To do this, use the Gradle wrapper from the root of the project, and use the -parallel flag:

./gradlew bootRun -parallel

Although the profile creates a multi-project build, it is also possible to combine both client and server projects into a single deployable artifact (WAR or JAR file). Refer to the Guide Combining the React profile projects to learn how.

3 Upgrade

You can explore the differences between Grails versions, to ease the upgrade of your Grails application created with the vue profile.

4 Profile Info

You can always get information about the provided command and available features executing grails profile-info vue

You will see an output similar to:

Profile: vue
A profile for creating Grails applications with a Vue.js frontend

Provided Commands:
* help - Prints help information for a specific command
* open - Opens a file in the project
* gradle - Allows running of Gradle tasks
* create-controller - Creates a controller
* create-domain-resource - Creates a domain class that represents a resource
* create-functional-test - Creates an functional test
* create-integration-test - Creates an integration test
* create-interceptor - Creates an interceptor
* create-restful-controller - Creates a REST controller
* clean - Cleans a Grails application's compiled sources
* compile - Compiles a Grails application
* create-command - Creates an Application Command
* create-domain-class - Creates a Domain Class
* create-service - Creates a Service
* create-unit-test - Creates a unit test
* install - Installs a Grails application or plugin into the local Maven cache
* assemble - Creates a JAR or WAR archive for production deployment
* bug-report - Creates a zip file that can be attached to issue reports for the current project
* console - Runs the Grails interactive console
* create-script - Creates a Grails script
* dependency-report - Prints out the Grails application's dependencies
* list-plugins - Lists available plugins from the Plugin Repository
* plugin-info - Prints information about the given plugin
* run-app - Runs a Grails application
* run-command - Executes Grails commands
* run-script - Executes Groovy scripts in a Grails context
* shell - Runs the Grails interactive shell
* stats - Prints statistics about the project
* stop-app - Stops the running Grails application
* test-app - Runs the applications tests
* generate-all - Generates a controller that performs REST operations
* generate-controller - Generates a controller that performs REST operations
* generate-functional-test - Generates a functional test for a controller that performs REST operations
* generate-unit-test - Generates a unit test for a controller that performs REST operations
* generate-views - Generates a controller that performs REST operations

Provided Features:
* security - Adds Spring Security REST to the project
* asset-pipeline - Adds Asset Pipeline to a Grails project
* events - Adds support for the Grails EventBus abstraction
* geb - Adds Geb and webdriver dependencies to run functional tests
* 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

5 Support

For support, please use the Groovy Community Slack or open an issue on Github