Module-level properties are specified in the module.properties file, located in the root directory of the module.

myModule
│ module.properties
└───resources
├───...
├───...
└───...

The following module.properties file is for a simple file-based module which contains no Java classes to compile:

Name: HelloWorld
ModuleClass: org.labkey.api.module.SimpleModule
Version: 1.0

Modules that contain Java classes should reference their main Java class. For example, the Issues module references the main controller class org.labkey.issue.IssuesModule:

ModuleClass: org.labkey.issue.IssuesModule
ModuleDependencies: Wiki, Experiment
Label: Issue Tracking Service
Description: The LabKey Issues module provides an issue tracker, a centralized workflow system for tracking issues or tasks across the lifespan of a project. Users can use the issue tracker to assign tasks to themselves or others, and follow the task through the work process from start to completion.
URL: https://www.labkey.org/wiki/home/Documentation/page.view?name=issues
Organization: LabKey
OrganizationURL: https://www.labkey.com/
License: Apache 2.0
LicenseURL: http://www.apache.org/licenses/LICENSE-2.0

Properties Reference

Available properties for modules. Note that property names vary slightly between module.property and module.xml files.

Property Name
(in module.xml)
Property Name
(in module.properties)
Description
classModuleClassMain class for the module. For modules without Java code, use org.labkey.api.module.SimpleModule
nameNameThe display name for the module.
versionVersionThe module version.
requiredServerVersionRequiredServerVersionoooThe minimum required version for LabKey Server.
moduleDependenciesModuleDependenciesA comma-delimited list of other module names this module depends upon. This determines module initialization order and controls the order in which SQL scripts run. For example, suppose your module includes a foreign key to a table in the Experiment module. In this case you could declare a dependency on the Experiment module, so that you can be sure that the target table exists before you try to create your foreign key. LabKey Server will give an error if you reference a module that doesn't exist, or if there's a circular dependency, for example, if ModuleA depends on ModuleB, which itself depends on ModuleA.
supportedDatabasesSupportedDatabasesAdd this property to indicate that your module runs only on a particular database. Possible values: "pgsql" or "mssql".
labelLabelOne line description of module's purpose (display capitalized and without a period at the end).
descriptionDescriptionMulti-line description of module.
urlURLThe homepage URL for additional information on the module.
authorAuthorComma separated list of names and, optionally, email addresses: e.g. "Adam Rauch <adamr@labkey.com>, Kevin Krouse"
maintainerMaintainerComma separated list of names and, optionally, email addresses: e.g. "Adam Rauch <adamr@labkey.com>, Kevin Krouse"
organizationOrganizationThe organization responsible for the module.
organizationURLOrganizationURLThe organization's URL/homepage.
licenseLicenseLicense name: e.g. "Apache 2.0", "GPL-2.0", "MIT"
licenseURLLicenseURLLicense URL: e.g. "http://www.apache.org/licenses/LICENSE-2.0"
vcsRevisionVcsRevisionThis value is set internally by the build, and does not need to be provided by the developer in module.properties. The SVN revision number of the module. This will be displayed next to the module in the site admin console.
vcsUrlVcsURLThis value is set internally by the build, and does not need to be provided by the developer in module.properties. The URL to the SVN server that manages the source code for this module. This will be displayed next to the module in the site admin console.
buildOSBuildOSThis value is set internally by the build, and does not need to be provided by the developer in module.properties. The operating system upon which the module was built. This will be displayed next to the module in the site admin console.
buildPathBuildPathThis value is set internally by the build, and does not need to be provided by the developer in module.properties. The file path in which the module was built. This will be displayed next to the module in the site admin console.
buildTimeBuildTimeThis value is set internally by the build, and does not need to be provided by the developer in module.properties. The date and time the module was built. This will be displayed next to the module in the site admin console.
buildTypeBuildTypePossible values are "Development" or "Production". "Development" modules will not deploy on a production machine. To build modules destined for a production server, run 'ant production', or add the following to your module.properties file: 'BuildType=Production'.
buildUserBuildUserThis value is set internally by the build, and does not need to be provided by the developer in module.properties. The name of the user that built the module. This will be displayed next to the module in the site admin console.
sourcePathSourcePathThis value is set internally by the build, and does not need to be provided by the developer in module.properties. The location of the module source code.
resourcePathResourcePathThis value is set internally by the build, and does not need to be provided by the developer in module.properties.
buildNumberBuildNumberThis value is set internally by the build, and does not need to be provided by the developer in module.properties. The build number.
enlistmentIdEnlistmentIdThis value is set internally by the build, and does not need to be provided by the developer in module.properties. Used to determine whether the module was built on the current server.

Properties Surfaced in the Admin Console

Module properties are surfaced in the user interface at Admin > Site > Admin Console, under the heading Module Information. Click an individual module name to see its properties. If you having problems loading/reloading a module, check the properties Enlistment ID and Source Path. When the server is running in devMode, these properties are displayed in green text if the values in module.xml match the values found the on the server; they are displayed in the red text if there is a mismatch.

The properties for deployed modules are available in the table core.Modules, where they can be accessed by the client API.

Generation of module.xml

When you run the standard Ant build targets in the open source project, the property/value pairs in module.properties are extracted and used to populate a module.xml file (via string substitution into module.template.xml). The resulting module.xml file is copied to the module's config subdirectory (MODULE_NAME/config/module.xml) and finally packaged into the built .module file. At deployment time, the server loads properties from config/module.xml, not module.properties (which the server ignores). Note that modules that contain Java code must be built using the standard build targets in the open source project.

Note that there are two different files named "module.xml" inside a module's source code: the one located at MODULE_NAME/module.xml is for declaring dependencies on libraries and other resources; the one located at MODULE_NAME/config/module.xml is generated based on module.properties and is for setting module properties.

An example module.xml file generated from module.properties:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
<bean id="moduleBean" class="org.labkey.api.module.SimpleModule">
<property name="name" value="mymodule"/>
<property name="version" value="0.0"/>
<property name="requiredServerVersion" value="0.0"/>
<property name="moduleDependencies" value="Wiki"/>
<property name="label" value="My Module"/>
<property name="description">
<value><![CDATA[My module helps users solves problems related to...]]></value>
</property>
<property name="url" value="https://www.mywebsite.com"/>
<property name="author">
<value><![CDATA[Jane Doe <janedoe@email.com>]]></value>
</property>
<property name="maintainer">
<value><![CDATA[John Doe <johndoe@email.com>]]></value>
</property>
<property name="organization" value="My Software Inc."/>
<property name="organizationUrl" value="https://www.my-software-inc.com/"/>
<property name="license" value="Apache 2.0"/>
<property name="licenseUrl" value="http://www.apache.org/licenses/LICENSE-2.0"/>
</bean>
</beans>

Related Topics


previousnext
 
expand allcollapse all