Fork me on GitHub

Plugin Documentation

This report describes goals, parameters details, requirements and sample usage of this plugin.

Goals

Goals available for this plugin:

Goal Description
sling:deploy
Deprecated. Use the OBR goals from the maven-bundle-plugin instead.

Deploy a JAR representing an OSGi Bundle to a Sling OSGi Bundle Repository. This method posts the bundle built by maven to the OSGi Bundle Repository. The plugin uses a multipart/format-data POST request to just post the file to the URL configured in the obr property.
sling:deploy-file
Deprecated. Use the OBR goals from the maven-bundle-plugin instead.

Deploy a JAR representing an OSGi Bundle to a Sling OSGi Bundle Repository. This method posts the bundle referenced via sling.file to an OSGi Bundle Repository accepting the bundle. The plugin uses a multipart/format-data POST request to just post the file to the URL configured in the obr property.
sling:fsmount Create OSGi configurations for the Apache Sling File System Resource Provider. In case a bundle file is supplied via bundleFileName the configuration for its initial content is created. Otherwise it tries to detect a FileVault content package layout starting at fileVaultJcrRootFile or the project's resource directories and potentially creates a configuration for each path in the package's filter.xml.
sling:fsunmount Remove OSGi configurations for the Apache Sling File System Resource Provider. In case a bundle file is supplied via bundleFileName the configuration for its initial content is created. Otherwise it tries to detect a FileVault content package layout starting at fileVaultJcrRootFile or the project's resource directories and potentially creates a configuration for each path in the package's filter.xml.
sling:generate-adapter-metadata Build adapter metadata (JSON) for the Web Console Plugin at /system/console/status-adapters and /system/console/adapters from classes annotated with adapter annotations.
sling:help Display help information on sling-maven-plugin.
Call mvn sling:help -Ddetail=true -Dgoal=<goal-name> to display parameter details.
sling:install Install the project's artifact to a running Sling instance (in case it is an OSGi bundle). It uses the first valid OSGi bundle file for deployment from the primary artifact and all secondary ones. For details refer to Bundle Installation. To install an arbitrary bundle not attached to the current Maven project use goal install-file.
sling:install-file Install an OSGi bundle from a given file path or Maven coordinates (resolved from the repository) to a running Sling instance. One of the following parameter sets are used to determine the bundle to install (evaluated in the given order):
  • groupId, artifactId, version, and optionally classifier and packaging
  • artifact
  • bundleFileName
To install a bundle which has been built from the current Maven project rather use goal install. For details refer to Bundle Installation.
sling:uninstall Uninstall an OSGi bundle from a running Sling instance. For details refer to Bundle Uninstallation.
sling:validate Validate all JSON files of a project. It only ensures they are well-formed but not that they are valid against a certain schema.

System Requirements

The following specifies the minimum requirements to run this Maven plugin:

Maven 3.8.1
JDK 11

System Requirements History

The following specifies the minimum requirements to run this Maven plugin for historical versions:

Plugin Version Maven JDK
3.0.4 3.8.1 11
3.0.2 3.3.1 8
from 2.4.0 to 2.4.2 3.0.4 8

Usage

You should specify the version in your project's plugin configuration:

<project>
  ...
  <build>
    <!-- To define the plugin version in your parent POM -->
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.sling</groupId>
          <artifactId>sling-maven-plugin</artifactId>
          <version>3.0.4</version>
        </plugin>
        ...
      </plugins>
    </pluginManagement>
    <!-- To use the plugin goals in your POM or parent POM -->
    <plugins>
      <plugin>
        <groupId>org.apache.sling</groupId>
        <artifactId>sling-maven-plugin</artifactId>
      </plugin>
      ...
    </plugins>
  </build>
  ...
</project>

For more information, see "Guide to Configuring Plug-ins"