Class FsMountMojo
java.lang.Object
org.apache.maven.plugin.AbstractMojo
org.apache.sling.maven.bundlesupport.FsMountMojo
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled
,org.apache.maven.plugin.Mojo
@Mojo(name="fsmount",
requiresProject=true)
public class FsMountMojo
extends org.apache.maven.plugin.AbstractMojo
Create OSGi configurations for the
Apache Sling File System Resource Provider.
In case a bundle file is supplied via
AbstractFsMountMojo.bundleFileName
the configuration for its initial content is created.
Otherwise it tries to detect a FileVault content package layout starting at AbstractFsMountMojo.fileVaultJcrRootFile
or the project's resource directories and potentially creates a configuration for each path in the package's filter.xml
.- Since:
- 2.2.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected boolean
Determines whether or not to fail the build if the HTTP POST or PUT returns an non-OK response code.protected org.apache.maven.project.MavenProject
The Maven project.protected org.eclipse.aether.RepositorySystemSession
protected List<org.eclipse.aether.repository.RemoteRepository>
protected org.eclipse.aether.RepositorySystem
protected URI
The WebConsole URL of the running Sling instance.protected URI
The URL of the running Sling instance.protected String
An optional url suffix which will be appended to thesling.url
for use as the real target url.Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
static URI
addTrailingSlash
(URI targetURL) protected void
configureFileVaultXml
(org.apache.hc.client5.http.impl.classic.CloseableHttpClient httpClient, URI consoleTargetUrl, File jcrRootFile, File filterXmlFile) protected void
configureSlingInitialContent
(org.apache.hc.client5.http.impl.classic.CloseableHttpClient httpClient, URI consoleTargetUrl, File bundleFile) protected void
ensureBundlesInstalled
(org.apache.hc.client5.http.impl.classic.CloseableHttpClient httpClient, URI consoleTargetUrl) void
execute()
protected String
getBundleSymbolicName
(File jarFile) Returns the symbolic name of the given bundle.protected URI
protected org.apache.hc.client5.http.impl.classic.CloseableHttpClient
protected org.apache.hc.client5.http.config.RequestConfig.Builder
protected URI
protected File
resolveArtifact
(org.eclipse.aether.artifact.Artifact artifact) Methods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
-
Field Details
-
project
@Parameter(defaultValue="${project}", readonly=true) protected org.apache.maven.project.MavenProject projectThe Maven project. -
slingUrl
@Parameter(property="sling.url", defaultValue="http://localhost:8080/system/console", required=true) protected URI slingUrlThe URL of the running Sling instance.The default is only useful for WebConsole deployment.
For WebDAV deployment it is recommended to include the Sling Simple WebDAV servlet root, for instance http://localhost:8080/dav/default/libs/sling/install. Omitting the
dav/default
segment can lead to conflicts with other servlets. -
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. -
slingUrlSuffix
An optional url suffix which will be appended to thesling.url
for use as the real target url. This allows to configure different target URLs in each POM, while using the same commonsling.url
in a parent POM (eg.sling.url=http://localhost:8080
andsling.urlSuffix=/project/specific/path
). This is typically used in conjunction with WebDAV or SlingPostServlet deployment methods. -
failOnError
@Parameter(property="sling.failOnError", defaultValue="true") protected boolean failOnErrorDetermines whether or not to fail the build if the HTTP POST or PUT returns an non-OK response code. -
repoSystem
@Component protected org.eclipse.aether.RepositorySystem repoSystem -
repoSession
@Parameter(defaultValue="${repositorySystemSession}", readonly=true, required=true) protected org.eclipse.aether.RepositorySystemSession repoSession -
repositories
@Parameter(defaultValue="${project.remoteProjectRepositories}", readonly=true, required=true) protected List<org.eclipse.aether.repository.RemoteRepository> repositories
-
-
Constructor Details
-
FsMountMojo
public FsMountMojo()
-
-
Method Details
-
addDeployFsResourceBundlePrerequisite
-
configureSlingInitialContent
protected void configureSlingInitialContent(org.apache.hc.client5.http.impl.classic.CloseableHttpClient httpClient, URI consoleTargetUrl, File bundleFile) throws org.apache.maven.plugin.MojoExecutionException - Throws:
org.apache.maven.plugin.MojoExecutionException
-
configureFileVaultXml
protected void configureFileVaultXml(org.apache.hc.client5.http.impl.classic.CloseableHttpClient httpClient, URI consoleTargetUrl, File jcrRootFile, File filterXmlFile) throws org.apache.maven.plugin.MojoExecutionException - Throws:
org.apache.maven.plugin.MojoExecutionException
-
ensureBundlesInstalled
protected void ensureBundlesInstalled(org.apache.hc.client5.http.impl.classic.CloseableHttpClient httpClient, URI consoleTargetUrl) throws org.apache.maven.plugin.MojoExecutionException - Throws:
org.apache.maven.plugin.MojoExecutionException
-
execute
public void execute() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException- Throws:
org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoFailureException
-
getBundleSymbolicName
Returns the symbolic name of the given bundle. If thejarFile
does not contain a manifest with aBundle-SymbolicName
headernull
is returned. Otherwise the value of theBundle-SymbolicName
header is returned.This method may also be used to check whether the file is a bundle at all as it is assumed, that only if the file contains an OSGi bundle will the
Bundle-SymbolicName
manifest header be set.- Parameters:
jarFile
- The file providing the bundle whose symbolic name is requested.- Returns:
- The bundle's symbolic name from the
Bundle-SymbolicName
manifest header ornull
if no manifest exists in the file or the header is not contained in the manifest. However, ifnull
is returned, the file may be assumed to not contain an OSGi bundle.
-
getTargetURL
- Returns:
- Returns the combination of
sling.url
andsling.urlSuffix
. Always ends with "/".
-
getConsoleTargetURL
- Returns:
- Returns the combination of
sling.console.url
andsling.urlSuffix
. Always ends with "/".
-
addTrailingSlash
-
getHttpClient
protected org.apache.hc.client5.http.impl.classic.CloseableHttpClient getHttpClient()- Returns:
- Get the http client
-
getRequestConfigBuilder
protected org.apache.hc.client5.http.config.RequestConfig.Builder getRequestConfigBuilder() -
resolveArtifact
protected File resolveArtifact(org.eclipse.aether.artifact.Artifact artifact) throws org.apache.maven.plugin.MojoExecutionException - Throws:
org.apache.maven.plugin.MojoExecutionException
-