Class BundleUninstallMojo
java.lang.Object
org.apache.maven.plugin.AbstractMojo
org.apache.sling.maven.bundlesupport.BundleUninstallMojo
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled,org.apache.maven.plugin.Mojo
@Mojo(name="uninstall")
public class BundleUninstallMojo
extends org.apache.maven.plugin.AbstractMojo
Uninstall an OSGi bundle from a running Sling instance.
For details refer to Bundle Uninstallation.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected BundleDeploymentMethodBundle deployment method.protected booleanDetermines whether or not to fail the build if the HTTP POST or PUT returns an non-OK response code.protected StringThe content type / mime type used for WebDAV or Sling POST deployment.protected org.apache.maven.project.MavenProjectThe Maven project.protected org.eclipse.aether.RepositorySystemSessionprotected List<org.eclipse.aether.repository.RemoteRepository> protected org.eclipse.aether.RepositorySystemprotected URIThe WebConsole URL of the running Sling instance.protected URIThe URL of the running Sling instance.protected StringAn optional url suffix which will be appended to thesling.urlfor use as the real target url.protected booleanDeprecated.Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic URIaddTrailingSlash(URI targetURL) protected voidconfigure(org.apache.hc.client5.http.impl.classic.CloseableHttpClient httpClient, URI targetURL, File file) voidexecute()protected Fileprotected StringgetBundleSymbolicName(File jarFile) Returns the symbolic name of the given bundle.protected URIprotected BundleDeploymentMethodRetrieve the bundle deployment method matching the configuration.protected org.apache.hc.client5.http.impl.classic.CloseableHttpClientprotected org.apache.hc.client5.http.config.RequestConfig.Builderprotected URIprotected FileresolveArtifact(org.eclipse.aether.artifact.Artifact artifact) Methods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
-
Field Details
-
usePut
Deprecated.UsedeploymentMethodinstead.If a PUT via WebDAV should be used instead of the standard POST to the Felix Web Console. In theuninstallgoal, a HTTP DELETE will be used. -
deploymentMethod
Bundle deployment method. One of the following three values are allowed- WebConsole, uses the
Felix Web Console REST API for deployment (HTTP POST). This is the default.
Make sure that
slingUrlpoints to the Felix Web Console in that case. - WebDAV, uses
WebDAV for deployment (HTTP PUT). Make sure that
slingUrlpoints to the entry path of the Sling WebDAV bundle (defaults to/dav/defaultin the Sling starter). Issues a HTTP Delete for the uninstall goal. - SlingPostServlet, uses the
Sling Post Servlet for deployment (HTTP POST).
Make sure that
slingUrlpoints a path which is handled by the Sling POST Servlet (usually below regular Sling root URL).
usePut. If nothing is set the default is eitherWebConsoleorWebDAV(whenusePutistrue). - WebConsole, uses the
Felix Web Console REST API for deployment (HTTP POST). This is the default.
Make sure that
-
mimeType
@Parameter(property="sling.mimeType", defaultValue="application/java-archive") protected String mimeTypeThe content type / mime type used for WebDAV or Sling POST deployment. -
project
@Parameter(defaultValue="${project}", required=true, 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/defaultsegment 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.urlfor use as the real target url. This allows to configure different target URLs in each POM, while using the same commonsling.urlin a parent POM (eg.sling.url=http://localhost:8080andsling.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
-
BundleUninstallMojo
public BundleUninstallMojo()
-
-
Method Details
-
getBundleFileName
-
execute
public void execute() throws org.apache.maven.plugin.MojoExecutionException- Specified by:
executein interfaceorg.apache.maven.plugin.Mojo- Throws:
org.apache.maven.plugin.MojoExecutionException- See Also:
-
configure
protected void configure(org.apache.hc.client5.http.impl.classic.CloseableHttpClient httpClient, URI targetURL, File file) throws org.apache.maven.plugin.MojoExecutionException - Throws:
org.apache.maven.plugin.MojoExecutionException
-
getDeploymentMethod
protected BundleDeploymentMethod getDeploymentMethod() throws org.apache.maven.plugin.MojoExecutionExceptionRetrieve the bundle deployment method matching the configuration.- Returns:
- bundle deployment method matching the plugin configuration.
- Throws:
org.apache.maven.plugin.MojoExecutionException- Exception
-
getBundleSymbolicName
Returns the symbolic name of the given bundle. If thejarFiledoes not contain a manifest with aBundle-SymbolicNameheadernullis returned. Otherwise the value of theBundle-SymbolicNameheader 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-SymbolicNamemanifest header be set.- Parameters:
jarFile- The file providing the bundle whose symbolic name is requested.- Returns:
- The bundle's symbolic name from the
Bundle-SymbolicNamemanifest header ornullif no manifest exists in the file or the header is not contained in the manifest. However, ifnullis returned, the file may be assumed to not contain an OSGi bundle.
-
getTargetURL
- Returns:
- Returns the combination of
sling.urlandsling.urlSuffix. Always ends with "/".
-
getConsoleTargetURL
- Returns:
- Returns the combination of
sling.console.urlandsling.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
-
deploymentMethodinstead.