Skip to content

3 Configuration

Kai Widmann edited this page Sep 6, 2024 · 22 revisions

Project Settings

The OpenCms plugin can be configured on a per project basis. That way a different plugin configuration for each of your OpenCms projects can be provided.

To get to the OpenCms plugin configuration click on File > Settings > Tools > OpenCms Plugin.

Activate Plugin for this Project

By checking this option the OpenCms plugin can be activated for the current project.

CMIS Repository

The Url of the OpenCms CMIS (Content Management Interoperability Services) interface. If you have a standard local OpenCms installation you can use the default http://localhost:8080/opencms/cmisatom/cmis-offline/. If you are running OpenCms in your web container's root context, then use http://localhost:8080/cmisatom/cmis-offline/.

For more information on CMIS have a look at the corresponding Wikipedia page.

Username

The username to use for accessing OpenCms, e.g. "Admin".

Password

The password to use for accessing OpenCms, e.g. "admin".

OpenCms Webapp Root

Path to your OpenCms webapp's root folder, e.g. /usr/local/tomcat/webapps/opencms. When on Windows, then provide the drive letter followed by a colon, e.g. C:/my/path/to/webapps/opencms. You can input backslashes here, they are converted to forward slashes automatically.

Module Naming Scheme

The naming scheme for your OpenCms modules. Let's say you have the following modules:

  • com.mycompany.opencms.contentdefinition
  • com.mycompany.opencms.templates

Then the naming scheme would be com.mycompany.opencms.${modulename}. The variable ${modulename} is replaced by the name of the IntelliJ module. When configuring a specific module you may provide a module name that differs from the naming scheme.

Default Local VFS Root

Each IntelliJ module representing an OpenCms module must have a folder where OpenCms resources are to be stored (configured relative to the module root). The default path is src/main/vfs. There you'll find all OpenCms resources like system/modules/com.mycompany.opencms.templates/templates/myTemplate.jsp. When configuring a specific module you may provide a local VFS root that differs from the default.

Default Sync Mode

The OpenCms plugin for IntelliJ offers three different Sync Modes:

  • PUSH - local FS is master, VFS resources not existing locally will be deleted from the VFS, all changes made in resources in OpenCms are overwritten.
  • SYNC - sync files to and from the VFS based on the modification date. Changes can be made to your local files and in OpenCms.
  • PULL - VFS is master, local resources not existing in the VFS will be deleted from the RFS, changes made to local files are overwritten by the corresponding files in the VFS.

Here you can select the default behaviour for all your modules, but when configuring a specific module you may provide a sync mode that differs from the default.

Ignored Files and Ignored Folders

Here you can configure which files and folders are not to be synced to the OpenCms VFS. Usually you will want to exclude meta files of version control systems like Git or SVN or "desktop.ini" files that can be found on Windows machines in folders containing images. The default values should be sufficient in most cases. If you happen to have some files or folders you want to exclude from syncing that are missing from the default lists, add them here.

Ignored files and folders use Regular Expressions. Dots (".") have to be escaped (".") if meant literally. You can use the full Regular Expression syntax, e.g.:

  • .* can be used as wildcard
  • .+ matches at least one character
  • [0-9]+ matches 1-n numbers
  • [a-z]+ matches 1-n lowercase letters
  • [A-Z]+ matches 1-n uppercase letters

Use the search engine of your choice to find out more about the power of Regular Expressions.

Module Zip Target Folder

The folder where packaged Module Zips will be stored (relative to the module's root folder) and from which modules will be imported. Defaults to "target".

Plugin Connector

The plugin connector is an additional component of the plugin that "talks" to the IDE connector, an OpenCms module that must be installed in your local OpenCms instance before it can be used. The plugin connector enables additional functionality like publishing, meta data pull and module import. For information on how to install the IDE connector module in OpenCms please refer to "Installing the IDE Connector".

By checking the option "Use the Plugin Connector" all options concerning the connector are enabled and can be configured.

Connector URL

The URL of the JSP acting as the IDE connector in OpenCms. If you have a standard local OpenCms 11 installation you can use the default http://localhost:8080/opencms/opencms/system/modules/com.mediaworx.opencms.ideconnector/connector.jsp. If you are running OpenCms in your web container's root context, then use http://localhost:8080/opencms/system/modules/com.mediaworx.opencms.ideconnector/connector.jsp. If you are using the OpenCms 10.5 version of the IDE Connector, the path is a little different since the module name is com.mediaworx.opencms.ideconnector105 instead of com.mediaworx.opencms.ideconnector [...]/system/modules/com.mediaworx.opencms.ideconnector105/connector.jsp

The Connector JSP is the old method of communicating with OpenCms, it is now augmented and will later be replaced by the new Connector Service (see below).

Connector Service

The connector service is handled by a Servlet that is the successor of the old JSP connector. Right now it adds additional functionality (importing modules), so both the JSP and Servlet connectors are used by the plugin, but we'll move functionality from the JSP to the Servlet over time and once that's finished, the JSP connector will be retired and removed.

If you want to be able to import modules from IntelliJ, activate the option "Use the Plugin Connectore Service ...". This will only work, if you have the IDE connector module 1.9 (com.mediaworx.opencms.ideconnector_1.9.zip) or above installed in your local OpenCms instance.

Please note that from version 2.1 on there are two distinct modules for OpenCms 11 (com.mediaworx.opencms.ideconnector_2.2.zip) and OpenCms 10.5 and below (com.mediaworx.opencms.ideconnector105_2.2.zip).

Service Url

The URL of the Servlet acting as the IDE Connector Service in OpenCms. If you have a standard local OpenCms installation you can use the default http://localhost:8080/opencms/ideConnector. If you are running OpenCms in your web container's root context, then use http://localhost:8080/ideConnector.

Auto Publish Mode

The OpenCms plugin for IntelliJ offers three different auto publish modes:

  • OFF - Nothing will be published automatically
  • FILECHANGE - File changes (delete, move and rename) will be published automatically. This is the default setting.
  • ALL - All resources synced to the VFS will be published automatically

Pull Meta Data

OpenCms resources have additional meta data (e.g. IDs and optional properties) that is not synced along with the files because real file systems usually don't offer this kind of meta data. If the option "Enable Meta Data Pull" is checked, then the meta data will be pulled each time you sync resources (files and/or folders) to or from the VFS.

Manifest Root

The folder where meta data is stored (relative to the module roots). The default value is src/main/manifest.

Use Meta Variables

In earlier versions of the OpenCms Plugin for IntellJ there was only one option for using meta variables, but we ran into trouble with changing UUIDs (see Basic Concepts), so we split the option into two separate options for dates and UUIDs.

Replace Dates

Check this option, if you want dates to be replaced with placeholders in meta data files. If you are working in a team and are using version control, we recommend to activate this option.

Replace UUIDs

If this option is checked, UUIDs are replaced by placeholders in meta data files. We found this to be the cause of some trouble (OpenCms couldn't find referenced resources, because UUIDs were changed), so we deprecated that option and recommend not to activate it. The option will be removed in a future release of the plugin.

OpenCms Module Settings (modern version using configuration files)

In older IntelliJ versions (before 2020) it was possible to configure the OpenCms module settings directly in IntelliJ's module configuration dialog. Unfortunately this convenient way is no longer available in newer versions of IntelliJ. Now you have to use a configuration file to achieve the same thing. If you configured your OpenCms modules the old way, the configuration is still read, but can't be changed. As soon as the configuration file exists, the old configuration is ignored.

Since using module based plugin components is discouraged by JetBrains, this change is presumably final.

Some tips on how to convert your existing settings to the new configuration file format can be found on Usage Hints.

To configure your OpenCms modules, create a file named opencms-module-config.json in the module root of each IntelliJ module that represents an OpenCms module.

The files should use UTF-8 character encoding. Since the settings may be different for each developer working on the project, the filename opencms-module-config.json should be excluded from version control (e.g. added to Git's ignore list).

Each json file must contain a JSON object with specific options, e.g.

{
    "openCmsModuleName": "default",
    "localVfsRoot": "default",
    "exportImportSiteRoot": "/",
    "syncMode": "SYNC",
    "moduleVersion": ""
}

For each OpenCms module those options have to be configured in a separate file, see below for further details on the options. IntelliJ modules not used as OpenCms modules don't need a configuration file at all.

Changes to the configuration files (e.g. changing a module's syncMode) are reflected right away, the OpenCms module configuration is reloaded after saving any of the files. This may take a few seconds though, since the reloading is done asynchronously.

openCmsModuleName

Options:

  • "default": Automatically generate the module package name according to the naming scheme provided in the project settings
  • if you want to provide a differing module package name, use anything but "default". That may be used if your module naming scheme doesn't match the name of the OpenCms module, e.g. "com.mycompany.another.name"

localVfsRoot

Options:

  • "default": Use the default path provided as "Default Local VFS Root" in the project settings
  • If you want to use a different path than the standard path for this module, it can be configured here, e.g. "src/main/different-vfs-path"

exportImportSiteRoot

Usually OpenCms modules are exported from and imported to the VFS root, that's done if you use the default setting "/". But sometimes you may want to use a different VFS path as export or import root, e.g. if you create a module with a site's content. If that's the case, you can configure the module's site root here, e.g. "/sites/default".

syncMode

Options (case sensitive, "default" is lowercase, all other options are uppercase):

  • "default": Use the default sync mode provided as "Default Sync Mode" in the project settings
  • "PUSH", "SYNC" or "PULL" (see project settings for details)

moduleVersion

The module version numbers are automatically increased by OpenCms whenever a module is edited and saved. Usually your local module version numbers are not representing real version numbers. By setting the option "moduleVersion" you can provide a version number that is to be set in the module manifest. You can provide any String here. We actually use this field to set the Maven variable ${moduleversion} in our manifests, the real version numbers are then provided by a Maven pom and integrated during a Maven build process.

Default OpenCms Module Configuration File

If you want to have default behaviour for all modules, just add a file named opencms-module-config.json using UTF-8 encoding in all of your IntelliJ modules representing OpenCms modules and use the following JSON content:

{
    "openCmsModuleName": "default",
    "localVfsRoot": "default",
    "exportImportSiteRoot": "/",
    "syncMode": "default",
    "moduleVersion": ""
}

You can also download the default configuration file here: opencms-module-config.json


Next: Plugin Components (Menus and Tool Window)