Skip to content

CLI Quick Reference

shiryaeva edited this page Dec 8, 2018 · 8 revisions

General Purpose

  • help - prints CUBA CLI help.
  • version - prints current CUBA CLI version,
  • cd - changes the current directory, if specified. Otherwise, prints the current one,
  • exit - exits CUBA CLI.

Project Setup and Global Settings

  • enable-premium-repo - adds premium CUBA repository to projects build script.
  • create-app - guides through the required steps to create a new CUBA project:
    • project name,
    • namespace,
    • root package,
    • platform version
    • and a database used in the project. The project will contain global (accessible from both core and web modules), core (server side layer for business logic) and web (server side layer for screen controllers and other GUI logic) modules.
  • create-polymer-module - adds a new client to the application, based on the Polymer library developed by Google. It modifies settings.gradle and build.gradle by adding the configuration and tasks for the new module. It also creates files of required image resources and generates login, menu, and other useful web-components for your Polymer front-end application.
  • extend-theme - generates a theme extension, i.e., a special structure of folders under the modules/web directory, a few images to brand the application (login icon, menu icon and favicon) and a few SCSS files, where you can modify the default scheme. It also adds the webThemesModule module and its configuration to the settings.gradle and build.gradle files. Finally, this command adds the deployThemes gradle task to be able to see changes without server restart.
  • add-component - plugs an existing application component into your application. It adds a new line into the dependencies block of your build.gradle and modifies web.xml of the web module adding the main package of the application component to the appComponents context parameter.

Domain Modeling

  • create-entity - generates a stub for JPA entity and its DDL script. This entity will be also registered in persistence.xml or metadata.xml, depending on the entity type - if it is persistent or not. Finally, CLI will generate a message pack to provide localizations for entity attributes.
  • create-enumeration - generates an Enum implementing the EnumClass interface, its fields with localization messages and a useful fromId() method.

Business Logic

  • create-entity-listener - scaffolds a Spring component implementing Entity Listeners interfaces and declares it in the corresponding Entity class. Such listeners are hooked when an entity changes its state.
  • create-service - scaffolds a service interface in the global module and its implementation in core. To be usable from the web module it gets registered in the WebRemoteProxyBeanCreator bean definition in web-spring.xml.
  • create-bean - simply generates a Spring component.
  • create-config - scaffolds a stub for a CUBA configuration interface in the specified module with the specified source type (System, DB or App).

User Interface

Misc

  • change-modules-prefix - changes modules prefix (see below).
  • create-app-component-xml - turns your CUBA application to be embeddable (pluggable) into another CUBA application. This command generates the app-component.xml file that defines the dependencies on other components, describes the existing application modules, generated artifacts and exposed application properties. While running the command it will prompt to change your current module prefix to a unique one in order to avoid conflicts. If you change the prefix it will also adjust settings.gradle and build.gradle files.
  • create-update-script - creates an SQL update script file, meeting CUBA conventions for its place and name. CUBA Platform includes the mechanism of applying update scripts on application start. These scripts should be executed in the historical order, from oldest to newest. To ensure such ordering update scripts should be placed under the modules/core/db/update/{USED DATABASE}/{yy}/ directory and named as {yyMMdd}-{INCREMENT}-{SCRIPT NAME}.sql.
  • use-template - generates project files from velocity templates, defined by a developer. Templating mechanism allows extending CLI command set declaratively and without compilation.
  • create-task - Gradle tasks creation commands. It lets you setup WAR and UberJAR deployment options.