sling:install

Full name:

org.apache.sling:maven-sling-plugin:2.3.2:install

Description:

Install an OSGi bundle to a running Sling instance. The plugin places an HTTP POST request to Felix Web Console. It's also possible to HTTP PUT instead of POST leveraging the WebDAV bundle from Sling. Since version 2.1.8 you can also leverage the the Sling POST servlet for that The chosen method depends on the parameter deploymentMethod.

Intermediate Node Creation

For all deploymentMethods except WebDAV the bundle is not directly deployed within the OSGi container, but rather being uploaded to the JCR and from there on being picked up by the JCR Installer Provider asynchronously, which takes care of deploying it in the OSGi container. For both other deployment methods, intermediate nodes (i.e. inexisting parent nodes) are automatically created. The primary type of those intermediate nodes depend on the deployment method.

  • WebDAV, uses the configured collection node type, by default sling:Folder (see also WebDAV Configuration)
  • SlingPostServlet, uses internally ResourceResolverFactory.create(...) without setting any jcr:primaryType. Therefore the JcrResourceProviderFactory will call Node.addNode(String relPath) which determines a fitting node type automatically, depending on the parents node type definition (see Javadoc). So in most of the cases this should be a sling:Folder, as this is the first allowed child node definition in sling:Folder. This only may differ, if your existing parent node is not of type sling:Folder itself.

Attributes:

  • Requires a Maven project to be executed.
  • Binds by default to the lifecycle phase: install.

Required Parameters

Name Type Since Description
bundleFileName String - The name of the generated JAR file.
Default value is: ${project.build.directory}/${project.build.finalName}.jar.
User property is: sling.file.
bundleStart boolean - Whether to start the uploaded bundle or not. Only applies when POSTing to Felix Web Console
Default value is: true.
User property is: sling.bundle.start.
bundleStartLevel String - The start level to set on the installed bundle. If the bundle is already installed and therefore is only updated this parameter is ignored. The parameter is also ignored if the running Sling instance has no StartLevel service (which is unusual actually). Only applies when POSTing to Felix Web Console.
Default value is: 20.
User property is: sling.bundle.startlevel.
failOnError boolean - Determines whether or not to fail the build if the HTTP POST or PUT returns an non-OK response code.
Default value is: true.
User property is: sling.failOnError.
mimeType String - The content type / mime type used for WebDAV or Sling POST deployment.
Default value is: application/java-archive.
User property is: sling.mimeType.
mountByFS boolean - Whether to add the mapping for the Apache Sling File System Resource Provider.
Default value is: false.
User property is: sling.mountByFS.
password String - The password to authenticate at the running Sling instance.
Default value is: admin.
User property is: sling.password.
refreshPackages boolean - Whether to refresh the packages after installing the uploaded bundle. Only applies when POSTing to Felix Web Console
Default value is: true.
User property is: sling.refreshPackages.
skip boolean - Whether to skip this step even though it has been configured in the project to be executed. This property may be set by the sling.install.skip comparable to the maven.test.skip property to prevent running the unit tests.
Default value is: false.
User property is: sling.install.skip.
slingUrl String - The URL of the running Sling instance. The default is only useful for WebConsole deployment.
Default value is: http://localhost:8080/system/console.
User property is: sling.url.
user String - The user name to authenticate at the running Sling instance.
Default value is: admin.
User property is: sling.user.

Optional Parameters

Name Type Since Description
deploymentMethod BundleDeploymentMethod - Bundle deployment method. One of the following three values are allowed
  1. WebConsole, uses the Felix Web Console REST API for deployment (HTTP POST). This is the default. Make sure that slingUrl points to the Felix Web Console in that case.
  2. WebDAV, uses WebDAV for deployment (HTTP PUT). Make sure that slingUrl points to the entry path of the Sling WebDAV bundle (usually below regular Sling root URL). Issues a HTTP Delete for the uninstall goal.
  3. SlingPostServlet, uses the Sling Post Servlet for deployment (HTTP POST). Make sure that slingUrl points a path which is handled by the Sling POST Servlet (usually below regular Sling root URL).
This has precedence over the deprecated parameter usePut.
User property is: sling.deploy.method.
slingConsoleUrl String - The WebConsole URL of the running Sling instance. This is required for file system provider operations. If not configured the value of slingUrl is used.
User property is: sling.console.url.
slingUrlSuffix String - An optional url suffix which will be appended to the sling.url for use as the real target url. This allows to configure different target URLs in each POM, while using the same common sling.url in a parent POM (eg. sling.url=http://localhost:8080 and sling.urlSuffix=/project/specific/path). This is typically used in conjunction with WebDAV or SlingPostServlet deployment methods.
User property is: sling.urlSuffix.
usePut boolean - Deprecated. Use deploymentMethod instead.
Default value is: false.
User property is: sling.usePut.

Parameter Details

bundleFileName:

The name of the generated JAR file.
  • Type: java.lang.String
  • Required: Yes
  • User Property: sling.file
  • Default: ${project.build.directory}/${project.build.finalName}.jar

bundleStart:

Whether to start the uploaded bundle or not. Only applies when POSTing to Felix Web Console
  • Type: boolean
  • Required: Yes
  • User Property: sling.bundle.start
  • Default: true

bundleStartLevel:

The start level to set on the installed bundle. If the bundle is already installed and therefore is only updated this parameter is ignored. The parameter is also ignored if the running Sling instance has no StartLevel service (which is unusual actually). Only applies when POSTing to Felix Web Console.
  • Type: java.lang.String
  • Required: Yes
  • User Property: sling.bundle.startlevel
  • Default: 20

deploymentMethod:

Bundle deployment method. One of the following three values are allowed
  1. WebConsole, uses the Felix Web Console REST API for deployment (HTTP POST). This is the default. Make sure that slingUrl points to the Felix Web Console in that case.
  2. WebDAV, uses WebDAV for deployment (HTTP PUT). Make sure that slingUrl points to the entry path of the Sling WebDAV bundle (usually below regular Sling root URL). Issues a HTTP Delete for the uninstall goal.
  3. SlingPostServlet, uses the Sling Post Servlet for deployment (HTTP POST). Make sure that slingUrl points a path which is handled by the Sling POST Servlet (usually below regular Sling root URL).
This has precedence over the deprecated parameter usePut.
  • Type: org.apache.sling.maven.bundlesupport.deploy.BundleDeploymentMethod
  • Required: No
  • User Property: sling.deploy.method

failOnError:

Determines whether or not to fail the build if the HTTP POST or PUT returns an non-OK response code.
  • Type: boolean
  • Required: Yes
  • User Property: sling.failOnError
  • Default: true

mimeType:

The content type / mime type used for WebDAV or Sling POST deployment.
  • Type: java.lang.String
  • Required: Yes
  • User Property: sling.mimeType
  • Default: application/java-archive

mountByFS:

Whether to add the mapping for the Apache Sling File System Resource Provider.
  • Type: boolean
  • Required: Yes
  • User Property: sling.mountByFS
  • Default: false

password:

The password to authenticate at the running Sling instance.
  • Type: java.lang.String
  • Required: Yes
  • User Property: sling.password
  • Default: admin

refreshPackages:

Whether to refresh the packages after installing the uploaded bundle. Only applies when POSTing to Felix Web Console
  • Type: boolean
  • Required: Yes
  • User Property: sling.refreshPackages
  • Default: true

skip:

Whether to skip this step even though it has been configured in the project to be executed. This property may be set by the sling.install.skip comparable to the maven.test.skip property to prevent running the unit tests.
  • Type: boolean
  • Required: Yes
  • User Property: sling.install.skip
  • Default: false

slingConsoleUrl:

The WebConsole URL of the running Sling instance. This is required for file system provider operations. If not configured the value of slingUrl is used.
  • Type: java.lang.String
  • Required: No
  • User Property: sling.console.url

slingUrl:

The URL of the running Sling instance. The default is only useful for WebConsole deployment.
  • Type: java.lang.String
  • Required: Yes
  • User Property: sling.url
  • Default: http://localhost:8080/system/console

slingUrlSuffix:

An optional url suffix which will be appended to the sling.url for use as the real target url. This allows to configure different target URLs in each POM, while using the same common sling.url in a parent POM (eg. sling.url=http://localhost:8080 and sling.urlSuffix=/project/specific/path). This is typically used in conjunction with WebDAV or SlingPostServlet deployment methods.
  • Type: java.lang.String
  • Required: No
  • User Property: sling.urlSuffix

usePut:

Deprecated. Use deploymentMethod instead.
If a PUT via WebDAV should be used instead of the standard POST to the Felix Web Console. In the uninstall goal, a HTTP DELETE will be used.
  • Type: boolean
  • Required: No
  • User Property: sling.usePut
  • Default: false

user:

The user name to authenticate at the running Sling instance.
  • Type: java.lang.String
  • Required: Yes
  • User Property: sling.user
  • Default: admin