Nuxeo CLI aims at making the whole development process easier with bootstraps for common Nuxeo components, sample projects to help you understand the hood and with the ability to trigger a hot reload of your developments in a running Nuxeo Server.
Installation
Nuxeo CLI is working like any shell program. After installing it, you'll be able to execute a nuxeo
binary from your terminal and unleash its power.
Requirements
- Node.js version = Latest LTS
Recommended Installation
The recommended installation is to use the NPM registry installation, and install nuxeo-cli
as a global package to make it available in your PATH
:
$ npm install -g nuxeo-cli
Install from Source Repository
If you are a very high skilled developer, and living in the edge, you can install it from the source repository:
$ npm install -g nuxeo/nuxeo-cli
Features
- Trigger the Hot reload which allows you to update the deployed bundles without restarting the Nuxeo Server.
- Provides some sample Nuxeo projects to help you understand the un-understandable.
- Bootstrap a bare Nuxeo project using Maven multiple modules structure.
- Adds a Nuxeo Package module to distribute your project (Marketplace)
- Adds a ready-to-use empty Polymer, Angular2 or ReactJS application.
- Create your own business rules or logic as an Automation Operation.
- Enrich REST API responses using a content enricher.
- Wrap your Business logic in Document Adapter.
- Declare your new Nuxeo Service.
- Plug your logic to an existing behavior with the event bus using an Event Listener.
- Bootstrap old-fashioned JSF objects like Seam-based UI action or bare Seam bean.
- Interact with your Nuxeo Studio's project
Commands
$ nuxeo <command> [options] [args]
Hot Reload
Triggering a hot reload on your server allows you to update some of your development modules without restarting the Nuxeo Server. To be done, it requires some simple modifications like to enable the sdk
template in your nuxeo.conf
file.
The first step is to associate a Nuxeo Server with your project root. Nuxeo CLI will ask you the distribution path and if you want to let it change nuxeo.conf
file for you. Reexecute it to change the distribution path.
$ nuxeo hotreload configure
Then, you will be able to trigger a hot reload using:
$ nuxeo hotreload
Studio
Connect your Studio project to your bundle dependencies to be able to add it directly in your package or testing that everything is working well together.
$ nuxeo studio
Bootstrap
To prevent unpredictable behaviors always execute the FIRST bootstrap command from the root folder of your project.
Options
-h, --help # Print options and usage
--skip-cache # Do not remember prompt answers Default: false
--skip-install # Do not automatically install dependencies Default: false
-m, --meta # Branch of `nuxeo/generator-nuxeo-meta` Default: stable
-l, --localPath # Path to a local clone of `nuxeo/generator-nuxeo-meta`
-n, --nologo # Disable welcome logo Default: false
-t, --type # Set module target's type Default: core
-s, --skipInstall # Skip external commands installation Default: false
-f, --force # Force conflict when generate an existing file Default: false
-d, --dirname # Set parent folder prefix name Default: <PWD>
Multiple Modules Empty Nuxeo Project
Set up an empty Nuxeo Bundle using Maven multiple modules support.
$ nuxeo bootstrap multi-module
multi-module
is the default generator when none is given as a parameter to nuxeo bootstrap
.
Important Note
Using a Maven multiple modules architecture is the recommended way to bootstrap a new project: it allows to generate a Nuxeo Package afterwards to easily deploy your code on a Nuxeo Server instance. If a project is generated using a single module architecture, the Nuxeo Package needs to be created manually.
Parameters
- Use a parent artifact: The parent artifact makes your project inherit dependencies, properties and other fields from another project. We recommend to keep the default value and use
org.nuxeo.ecm.distribution:nuxeo-distribution
. - Nuxeo Version: Asked only if no parent is specified. It specifies which Nuxeo version of the dependency management will be imported.
Empty Nuxeo Project
Set up an empty Nuxeo project; not recommended for project initialization.
$ nuxeo bootstrap single-module
Important Notes
You should use this command to initiate a project that stands in a single Maven module, without the need to be distributed with a Nuxeo Package. Otherwise, use the multi-module
option instead so that you can generate a Nuxeo Package later on.
Parameters
- Parent Group / Artifact: Like in
multi-module
, having a parent artifact enables project inheritance. If you are in amulti-module
, you must set your parent module. If not, you can useorg.nuxeo.ecm.distribution:nuxeo-distribution
ororg.nuxeo:nuxeo-addons-parent
. - Nuxeo Version: Asked only if needed, it specifies which Nuxeo version of the dependency management will be imported.
Unit Test
Add an empty Unit Test
$ nuxeo bootstrap test-empty
Bare Component
Add an empty Contribution
$ nuxeo bootstrap contribution
Business Rules or Logic - Automation Operation
Add an empty Automation Operation along with a corresponding unit test.
$ nuxeo bootstrap operation
Event Bus Listener
Adds a listener with its test class. The events will be asked during the generation process. Both existing and custom events can be declared. You can create any listener type: pre-commit, post-commit, synchronous and asynchronous.
$ nuxeo bootstrap listener
Parameters
- Trigger on events: List of some common events to bind to your listener.
- Custom Events: In case you select 'custom events' in the previous list; comma separated list of other events.
- Asynchronous Listener: If you need to run after the transaction has committed, in a new transaction and a separate thread. This is useful for any long-running operation whose result doesn't have to be seen immediately in the user interface.
- Post-commit Listener: If you need to run after the transaction has committed, in a new transaction but in the same thread. This is useful for logging.
Service
Adds a Nuxeo component exposed as a Nuxeo service.
$ nuxeo bootstrap service
REST API Response Enricher
Creates a content enricher that enriches with more information a REST response using request's headers.
$ nuxeo bootstrap enricher
Business Object - Document Adapter
Creates a Document Adapter that turns DocumentModel
objects into a business objects.
$ nuxeo bootstrap adapter
JSF - Seam UI Action Bean
For compatibility, creates a new action in the JSF UI with an Seam Bean bound to it.
$ nuxeo bootstrap seam-action
JSF - Seam Controller Bean
For compatibility, creates a new controller bean to lets you create or change behaviors in JSF UI.
$ nuxeo bootstrap seam-action
Empty Polymer Application
Add an application based on Polymer Starter Kit bundled as a Nuxeo Project.
$ nuxeo bootstrap polymer
# npm and bower install must be executed automatically, otherwise:
# cd *-web && npm install && bower install
# To run the application in dev mode; with file changes watch:
$ cd *-web && npm run serve
Empty Angular2 Application
Add an application using Angular2 bundled as a Nuxeo Project.
$ nuxeo bootstrap angular2
# npm and bower install must be executed automatically, otherwise:
# cd *-web && npm install && bower install
# To run the application in dev mode; with file changes watch:
$ cd *-web && npm run dev
Empty ReactJS Application
Add an application using ReactJS bundled as a Nuxeo Project.
$ nuxeo bootstrap reactjs
# `npm install` must be executed automatically, otherwise:
# cd *-web && npm install
# To run the application in dev mode; with file changes watch:
$ cd *-web && gulp serve
Nuxeo Package Module
Creates a module that generate a Nuxeo Package for your project. Can only be called in a Maven multi-module architecture, hence make sure to bootstrap your project using nuxeo bootstrap
or nuxeo bootstrap multi-module
. If you used nuxeo bootstrap single-module
to bootstrap your project, you won't be able to call that option afterwards.
$ nuxeo bootstrap package
Sample
Discover a ready-to-use Nuxeo Project to help you understand tricky components like BlobProvider
:
$ nuxeo sample