Start plugin

A plugin to start up Magnolia and display the logs.

Package name

@magnolia/cli-start-plugin

Repository link

Latest version

Magnolia CLI start plugin - latest version tag

Changelog link

By default, the start command searches within the current directory for a folder whose name begins with apache-tomcat. If you need to specify a different directory, use the -t <path> (or --tomcat <path>) option.

Magnolia loads light modules from a location specified in the magnolia.resources.dir property in the magnolia.properties file.

For more information about the magnolia.resources.dir property, see here.
Even though the light-modules folder is in the project structure, and you want to use this folder, you must pass it through the option to indicate that you want to override the default magnolia.resources.dir. To override the default magnolia.resources.dir value, use the -lmp <path> or --light-modules-path <path> option.
Use the Jumpstart plugin (see: Jumpstarting a project) to create a project directory.

The plugin automatically updates the magnolia.resources.dir property to the light-modules folder of the project and prepares the required configuration for you.

To stop a running Magnolia, press CTRL+C. The plugin will start the stop process and will inform you when Magnolia stops.

Installing

The plugin doesn’t come pre-installed with Magnolia CLI. You must add it to the mgnl.config.js project file.

The plugin is installed automatically by the Jumpstart plugin if it is defined in a project template.

With add-plugin

Run the following command in the project folder.

npm run mgnl -- add-plugin @magnolia/cli-start-plugin

The command automatically downloads, installs, and registers the plugin in the mgnl.config.js file.

Manually

  1. Run the following command in the project folder.

    npm install @magnolia/cli-start-plugin
  2. Modify the mgnl.config.js file accordingly.

    import StartPlugin from "@magnolia/cli-start-plugin";
    
    export default {
      plugins: [
        new StartPlugin()
      ]
    };

Usage

Command

start [options]

Options

Form (short and long) Description

-t [path]

--tomcat [path]

Sets the path to the apache-tomcat directory or a directory containing it. By default, it uses the current working directory.

-lmp [path]

--light-modules-path [path]

Sets the path to the light-modules folder. By default, it uses mgnl.config.js or magnolia.resources.dir in magnolia.properties.

-v

--version

Displays the version.

-h

--help

Displays help information.

Examples

In the following examples, assume that the mgnl.config.js file looks like this:

import StartPlugin from "@magnolia/cli-start-plugin";

export default {
  plugins: [
    new StartPlugin()
  ]
};

For more information, see Configuring plugins.

Start Magnolia

npm run mgnl -- start

If the apache-tomcat isn’t found in the current working directory, the plugin will prompt you to specify the directory.

The plugin writes the following properties to the mgnl.config.js file:

  • Plugin

    • tomcatPath

Start Magnolia with a specific apache-tomcat path

npm run mgnl -- start --tomcat "./magnolia/apache-tomcat"

If the ./magnolia/apache-tomcat directory doesn’t exist, the plugin will prompt you to specify the directory.

The plugin writes the following properties to the mgnl.config.js file:

  • Plugin

    • tomcatPath

Start Magnolia with a specific light-modules path

npm run mgnl -- start --light-modules-path "./magnolia/light-modules"

This command initializes Magnolia with modules loaded from the ./magnolia/light-modules directory.

If the apache-tomcat isn’t found in the current working directory, the plugin will prompt you to specify the directory.

If the ./magnolia/light-modules directory doesn’t exist, the plugin will prompt you to choose the directory containing all light modules.

The plugin writes the following properties to the mgnl.config.js file:

  • Global

    • lightModulesPath

  • Plugin

    • tomcatPath

Configuration

You can set the following properties in mgnl.config.js to predefine the plugin’s behavior.

Global properties

Property name Description

lightModulesPath

The path to a directory containing all light modules.

Alternative forms: -lmp [path], --light-modules-path [path]

Plugin properties

Property name Description

tomcatPath

The path to the apache-tomcat directory.

Alternative forms: -t [path], --tomcat [path]

For more information, see Configuring plugins.

Feedback

DX Core

×

Location

This widget lets you know where you are on the docs site.

You are currently perusing through the Magnolia CLI docs.

Main doc sections

DX Core Headless PaaS Legacy Cloud Incubator modules