ct-jsregistry-maven-plugin
The ct-jsregistry-maven-plugin provides tools to optimize the JavaScript and CSS source code and is a helper for artifact deployment. This section describes the configuration properties.
Goals
help
Display help for the ct-jsregistry-maven-plugin.
> mvn de.conterra.jsregistry:ct-jsregistry-maven-plugin:<version>:help -Ddetail=true
Set <version> to your current ct-jsregistry version, for example: 1.0.0
Parameter | Default | Description |
---|---|---|
|
|
If |
|
|
The name of the goal to show help for. If unspecified, all goals are displayed. |
|
|
The number of spaces per indentation level, should be positive. |
|
|
The maximum length of a display line, should be positive. |
buildPacksProperties
Builds a META-INF/js-registry-packs.properties
file.
It should be used in JAR
-projects to keep the metadata files up to date.
Binds by default to the process-resources lifecycle.
<plugin>
<groupId>de.conterra.jsregistry</groupId>
<artifactId>ct-jsregistry-maven-plugin</artifactId>
<executions>
<execution>
<id>buildPacksProperties</id>
<goals>
<goal>buildPacksProperties</goal>
</goals>
</execution>
</executions>
<configuration>
<sourceDirectory>${project.build.directory}/${project.artifactId}/js</sourceDirectory>
<outputDirectory>${project.build.directory}/${project.artifactId}/js</outputDirectory>
<scanPackagesIncludes>**</scanPackagesIncludes>
<scanPackagesExcludes>**/tests/**,sample/**,apps/**</scanPackagesExcludes>
</configuration>
</plugin>
Parameter | Default | Description |
---|---|---|
|
|
The source folder to scan for packages |
|
|
The output directory into which the packs is written. |
|
Glob patterns defining the directories to exclude during scan for packages.
Relative to |
|
|
|
Glob patterns defining the directories to include during scan for packages.
Relative to |
buildRegistryIndex
Builds a bundles.json
file in the outputDirectory containing all meta information about available bundles in the file system.
This goal is helpful if no JS registry service is available, for example in offline apps.
Binds by default to the process-resources lifecycle.
<plugin>
<groupId>de.conterra.jsregistry</groupId>
<artifactId>ct-jsregistry-maven-plugin</artifactId>
<executions>
<execution>
<id>build bundles.json</id>
<goals>
<goal>buildRegistryIndex</goal>
</goals>
</execution>
</executions>
<configuration>
<sourceDirectory>${project.build.directory}/${project.artifactId}/js</sourceDirectory>
<outputDirectory>${project.build.directory}/${project.artifactId}/js</outputDirectory>
<scanPackagesIncludes>**</scanPackagesIncludes>
<scanPackagesExcludes>**/tests/**,sample/**,apps/**</scanPackagesExcludes>
<inlinePackageJson>true</inlinePackageJson>
<outputFile>bundles.json</outputFile>
</configuration>
</plugin>
Parameter | Default | Description |
---|---|---|
|
|
The source folder to scan for packages. |
|
|
The output directory into which the packs is written. |
|
Glob patterns defining the directories to exclude during scan for packages.
Relative to |
|
|
|
Glob patterns defining the directories to include during scan for packages.
Relative to |
|
|
Inlines the |
|
|
Name of the registry file to create. |
convertManifestToPackage
Converts manifest.json
files to package.json
files.
This is a goal normally used on the command line to upgrade a project to the new format.
Binds to no specific lifecycle phase.
mvn de.conterra.jsregistry:ct-jsregistry-maven-plugin:<version>:convertManifestToPackage \
-Dmanifest.input=${project.build.sourceDirectory} \
-Dmanifest.output=${project.build.sourceDirectory} \
-Dmanifest.includes=** \
-Dmanifest.excludes=**/tests/** \
-Dmanifest.delete=true
<plugin>
<groupId>de.conterra.jsregistry</groupId>
<artifactId>ct-jsregistry-maven-plugin</artifactId>
<executions>
<execution>
<id>convertManifestToPackage</id>
<goals>
<goal>convertManifestToPackage</goal>
</goals>
</execution>
</executions>
<configuration>
<sourceDirectory>${project.build.directory}/${project.artifactId}/js</sourceDirectory>
<outputDirectory>${project.build.directory}/${project.artifactId}/js</outputDirectory>
<scanPackagesIncludes>**</scanPackagesIncludes>
<scanPackagesExcludes>**/tests/**</scanPackagesExcludes>
<deleteManifestFiles>true</deleteManifestFiles>
</configuration>
</plugin>
Parameter | Default | Description |
---|---|---|
|
|
The output directory |
|
|
The classes folder to scan for packages. |
|
Glob patterns defining the directories to exclude during scan for packages.
Relative to |
|
|
|
Glob patterns defining the directories to include during scan for packages.
Relative to |
|
|
Whether the converted |
optimizeCSS
Compresses CSS files in a directory.
Binds by default to the process-resources lifecycle.
<plugin>
<groupId>de.conterra.jsregistry</groupId>
<artifactId>ct-jsregistry-maven-plugin</artifactId>
<executions>
<execution>
<id>optimize-css</id>
<goals>
<goal>optimizeCSS</goal>
</goals>
<configuration>
<sourceDirectory>${project.build.directory}/${project.artifactId}</sourceDirectory>
<outputDirectory>${project.build.directory}/${project.artifactId}</outputDirectory>
<cssFiles>
<includes>
<include>js/bundles/base/themes/themes/*/*.css</include>
<include>js/bundles/base/templates/templates/*/*.css</include>
</includes>
<excludes>
<exclude>**/themeSettings.css</exclude>
</excludes>
</cssFiles>
</configuration>
</execution>
</executions>
</plugin>
Parameter | Default | Description |
---|---|---|
|
|
Whether to only remove comments and whitespace. |
|
|
Whether to remove comments and whitespace and perform some other CSS compression task. |
|
|
Whether to break lines so that one line is not too long for some environments |
|
|
The output directory to which the optimized CSS files are written. |
|
|
The directory in which the CSS files are located. |
|
|
Whether to inline include statements in the CSS files. |
|
|
A comma-separated list of includes that should be preserved, for example |
|
|
Whether to check for the Internet Explorer CSS selector limit of 4095 selectors per file. If the limit is reached, the input file is split into multiple files. |
|
|
include/exclude pattern used to find CSS files.
|
optimizeJS
Scans each package/bundle and optimizes single JavaScript files. — compress — inlineStrings
Binds by default to the compile lifecycle.
<plugin>
<groupId>de.conterra.jsregistry</groupId>
<artifactId>ct-jsregistry-maven-plugin</artifactId>
<executions>
<execution>
<id>optimize-js</id>
<goals>
<goal>optimizeJS</goal>
</goals>
<configuration>
<sourceDirectory>${project.build.directory}/${project.artifactId}</sourceDirectory>
<outputDirectory>${project.build.directory}/${project.artifactId}</outputDirectory>
<jsFiles>
<includes>
<include>myfile.js</include>
</includes>
<excludes>
<exclude>donotinclude.js</exclude>
</excludes>
</jsFiles>
<hasFeatures>
<ct-debug>false</ct-debug>
</hasFeatures>
</configuration>
</execution>
</executions>
</plugin>
Parameter | Default | Description |
---|---|---|
|
|
Whether to inline imported HTML resources in the generated output files. |
|
|
Whether to compress the output files using the closure compiler. |
|
|
Whether to remove console.debug() statements from the output files. This works only if compress is true. Valid values are "warn", "error", "all" or "". |
|
Include/exclude pattern used to find JS files in
|
|
|
|
Static has features (see dojo/has ) which are introduced in the source code during build.
Allows execution path removal during build time.
This works only if For example, the following setting in the
The JavaScript code looks like this before optimizing:
If
|
|
|
The output directory in which all dependencies.json files are generated. |
|
|
The directory in which all relative js paths are calculated too. |
|
Glob patterns defining the directories to exclude during scan for packages.
Relative to |
|
|
|
Glob patterns defining the directories to include during scan for packages.
Relative to |
calculateDependencies
Calculates dependencies.json
files for each AMD package/bundle.
This goal is required for the buildLayers
goal.
Binds by default to process-resources lifecycle.
<plugin>
<groupId>de.conterra.jsregistry</groupId>
<artifactId>ct-jsregistry-maven-plugin</artifactId>
<executions>
<execution>
<id>calc-deps</id>
<goals>
<goal>calculateDependencies</goal>
</goals>
<configuration>
<sourceDirectory>${project.build.directory}/${project.artifactId}</sourceDirectory>
<outputDirectory>${project.build.directory}/${project.artifactId}</outputDirectory>
<skipPackages>dojo,dijit,dojox,esri,dgrid,put-selector,xstyle</skipPackages>
</configuration>
</execution>
</executions>
</plugin>
Parameter | Default | Description |
---|---|---|
|
|
The name of the generated 'dependency' files ( |
|
|
List of AMD packages (like bundles) that should not be traversed.
The package names must be separated by commas like in the following sample: |
|
|
The output directory where all |
|
|
The directory to search for packages. |
|
Glob patterns defining the directories to exclude during the scan for packages.
Relative to |
|
|
Glob patterns defining the directories to include during the scan for packages.
Relative to |
buildLayers
This goal concatenates different JavaScript files into one file.
Such a file is called "layer".
It requires dependency information from the dependencies.json
file which is created by the calculateDependencies
goal.
Binds by default to process-classes lifecycle.
<plugin>
<groupId>de.conterra.jsregistry</groupId>
<artifactId>ct-jsregistry-maven-plugin</artifactId>
<executions>
<execution>
<id>build-layers</id>
<goals>
<goal>buildLayers</goal>
</goals>
<configuration>
<sourceDirectory>${project.build.directory}/${project.artifactId}</sourceDirectory>
<outputDirectory>${project.build.directory}/${project.artifactId}</outputDirectory>
<layers>
<layer>
<name>apps/mylayer</name>
<includes>
<include>system</include>
<include>themes</include>
<include>templates</include>
</includes>
<excludes>
<!-- Attention: this removes not only mapflow, but also also all of its dependencies! For one large layer file not needed! -->
<exclude>mapflow</exclude>
<exclude>!esri/*</exclude>
</excludes>
<!-- By default en is included in the layer file -->
<locales>
<locale>de</locale>
</locales>
</layer>
</layers>
</configuration>
</execution>
</executions>
</plugin>
Parameter | Default | Description | ||
---|---|---|---|---|
|
|
How are the generated 'dependency' files are named (dependencies.json). |
||
|
|
The JS layer definitions. Example:
The following special include patterns are supported:
The next include patterns are only of interest for direct plain JavaScript file inclusion, which are not AMD files.
These patterns are only useful for creating a layer to contain
The following special exclude patterns are supported:
Sample: |
||
|
|
The output directory for the layer files. |
||
|
|
The directory where all relative JavaScript source files are located. |
||
|
|
scanPackagesIncludes |
deployJSPackage
Uploads a ZIP or a JAR file containing JavaScript packages to the JS Registry.
Binds by default to the package lifecycle.
<plugin>
<groupId>de.conterra.jsregistry</groupId>
<artifactId>ct-jsregistry-maven-plugin</artifactId>
<executions>
<execution>
<id>deploy-bundles</id>
<goals>
<goal>deployJSPackage</goal>
</goals>
<configuration>
<registryEndpoint>http://localhost:8080/resources/jsregistry</registryEndpoint>
<file>${project.build.directory}/${project.build.finalName}.jar</file>
<username>admin</username>
<password>admin</password>
</configuration>
</execution>
</executions>
</plugin>
Parameter | Default | Description |
---|---|---|
|
URL pointing to the JS Registry server. |
|
|
|
The file containing the packages to upload (zip/jar). |
|
Username to authenticate against the registry. |
|
|
Password to authenticate against the registry. |
|
|
|
Defines if the plugin trusts any SSL servers without checking a trust store. |
|
|
Defines that content upload is using Chunked Request Encoding. If false uploads are buffered in memory to calculate the content length. |