Class BundleDeployFileMojo

java.lang.Object
org.apache.maven.plugin.AbstractMojo
org.apache.sling.maven.bundlesupport.BundleDeployFileMojo
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo

@Deprecated @Mojo(name="deploy-file", requiresProject=false) public class BundleDeployFileMojo extends org.apache.maven.plugin.AbstractMojo
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.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected boolean
    Determines whether or not to fail the build if the HTTP POST or PUT returns an non-OK response code.
    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 the sling.url for use as the real target url.

    Fields inherited from interface org.apache.maven.plugin.Mojo

    ROLE
  • Constructor Summary

    Constructors
    Constructor
    Description
    Deprecated.
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static URI
    addTrailingSlash(URI targetURL)
     
    protected File
    changeVersion(File file, String oldVersion, String newVersion)
    Deprecated.
    Change the version in jar
    void
    Deprecated.
    Execute this Mojo
    protected File
    Deprecated.
    Optionally fixes up the version of the bundle given in the jar File.
    protected String
    Returns the symbolic name of the given bundle.
    protected URI
     
    protected org.apache.hc.client5.http.impl.classic.CloseableHttpClient
     
    protected String
    Deprecated.
    Returns the path and name of the jar file containing the bundle to be uploaded.
    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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • slingUrl

      @Parameter(property="sling.url", defaultValue="http://localhost:8080/system/console", required=true) protected URI slingUrl
      The 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

      @Parameter(property="sling.console.url") protected URI 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

      @Parameter(property="sling.urlSuffix") protected String 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.
    • failOnError

      @Parameter(property="sling.failOnError", defaultValue="true") protected boolean failOnError
      Determines 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

    • BundleDeployFileMojo

      public BundleDeployFileMojo()
      Deprecated.
  • Method Details

    • getJarFileName

      protected String getJarFileName() throws org.apache.maven.plugin.MojoExecutionException
      Deprecated.
      Returns the path and name of the jar file containing the bundle to be uploaded. This method always returns a non-null name but throws a MojoExecutionException if the name is not known.
      Returns:
      The name of the file to be uploaded, this is never null.
      Throws:
      org.apache.maven.plugin.MojoExecutionException - If the name of the file is not known because it might not have been configured.
    • fixBundleVersion

      protected File fixBundleVersion(File jarFile)
      Deprecated.
      Optionally fixes up the version of the bundle given in the jar File. If no version fixup is required the jarFile may just be returned.
      Parameters:
      jarFile - The file whose bundle version should be fixed
      Returns:
      The file containing the fixed version or jarFile if the version was not fixed.
    • execute

      public void execute() throws org.apache.maven.plugin.MojoExecutionException
      Deprecated.
      Execute this Mojo
      Throws:
      org.apache.maven.plugin.MojoExecutionException
    • changeVersion

      protected File changeVersion(File file, String oldVersion, String newVersion) throws org.apache.maven.plugin.MojoExecutionException
      Deprecated.
      Change the version in jar
      Parameters:
      file - File
      oldVersion - Old version
      newVersion - New version
      Returns:
      File
      Throws:
      org.apache.maven.plugin.MojoExecutionException - Exception
    • getBundleSymbolicName

      protected String getBundleSymbolicName(File jarFile)
      Returns the symbolic name of the given bundle. If the jarFile does not contain a manifest with a Bundle-SymbolicName header null is returned. Otherwise the value of the Bundle-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 or null if no manifest exists in the file or the header is not contained in the manifest. However, if null is returned, the file may be assumed to not contain an OSGi bundle.
    • getTargetURL

      protected URI getTargetURL()
      Returns:
      Returns the combination of sling.url and sling.urlSuffix. Always ends with "/".
    • getConsoleTargetURL

      protected URI getConsoleTargetURL()
      Returns:
      Returns the combination of sling.console.url and sling.urlSuffix. Always ends with "/".
    • addTrailingSlash

      public static URI addTrailingSlash(URI targetURL)
    • 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