Class AssemblyMojo

  • All Implemented Interfaces:
    org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo

    @Mojo(name="assembly",
          defaultPhase=PACKAGE,
          requiresDependencyResolution=RUNTIME,
          threadSafe=true)
    public class AssemblyMojo
    extends MojoSupport
    Creates a customized Karaf distribution by installing features and setting up configuration files.

    The plugin gets features from feature.xml files and KAR archives declared as dependencies or as files configured with the [startup|boot|installed]Respositories parameters. It picks up other files, such as config files, from ${project.build.directory}/classes. Thus, a file in src/main/resources/etc will be copied by the resource plugin to ${project.build.directory}/classes/etc, and then added to the assembly by this goal.

    • Field Detail

      • sourceDirectory

        @Parameter(defaultValue="${project.basedir}/src/main/resources/assembly")
        protected File sourceDirectory
        Base directory used to overwrite resources in generated assembly after the build (resource directory).
      • workDirectory

        @Parameter(defaultValue="${project.build.directory}/assembly")
        protected File workDirectory
        Base directory used to copy the resources during the build (working directory).
      • featuresProcessing

        @Parameter
        protected File featuresProcessing
        Optional location for custom features processing XML configuration (etc/org.apache.karaf.features.cfg)
      • installAllFeaturesByDefault

        @Parameter(defaultValue="true")
        protected boolean installAllFeaturesByDefault
        For given stage (startup, boot, install) if there are no stage-specific features and profiles, all features from stage-specific repositories will be used.
      • defaultStartLevel

        @Parameter
        protected int defaultStartLevel
        Default start level for bundles in features that don't specify it.
      • ignoreDependencyFlag

        @Parameter(defaultValue="false")
        protected boolean ignoreDependencyFlag
        Ignore the dependency attribute (dependency="[true|false]") on bundles, effectively forcing their installation.
      • libraries

        @Parameter
        protected List<String> libraries

        Additional libraries to add into assembled distribution. Libraries are specified using name[;url:=<url>][;type:=<type>][;export:=true|false][;delegate:=true|false] syntax. If there's no url header directive, name is used as URI. Otherwise name is used as target file name to use.

        type may be:

        • endorsed - library will be added to ${karaf.home}/lib/endorsed
        • extension - library will be added to ${karaf.home}/lib/ext
        • boot - library will be added to ${karaf.home}/lib/boot
        • by default, library is put directly into ${karaf.home}/lib - these libraries will be used in default classloader for OSGi framework which will load FrameworkFactory implementation.

        export flag determines whether packages from Export-Package manifest header of the library will be added to org.osgi.framework.system.packages.extra property in ${karaf.etc}/config.properties.

        delegate flag determines whether packages from Export-Pavkage manifest header of the library will be added to org.osgi.framework.bootdelegation property in ${karaf.etc}/config.properties.

      • useReferenceUrls

        @Parameter(defaultValue="false")
        protected boolean useReferenceUrls
        Use reference:file:gr/oup/Id/artifactId/version/artifactId-version-classifier.type style urls in etc/startup.properties.
      • includeBuildOutputDirectory

        @Parameter(defaultValue="true")
        protected boolean includeBuildOutputDirectory
        Include project build output directory in the assembly. This allows (filtered or unfiltered) Maven resources directories to be used to provide additional resources in the assembly.
      • karafVersion

        @Parameter
        protected org.apache.karaf.profile.assembly.Builder.KarafVersion karafVersion
        Karaf version changes the way some configuration files are prepared (to adjust to given Karaf version requirements).
      • javase

        @Parameter(defaultValue="1.8")
        protected String javase
        Specify the version of Java SE to be assumed for osgi.ee. The value will be used in etc/config.properties file, in java.specification.version placeholder used in several properties:
        • org.osgi.framework.system.packages
        • org.osgi.framework.system.capabilities

        Valid values are: 1.6, 1.7, 1.8, 9

      • framework

        @Parameter
        protected String framework
        Specify which framework to use (one of framework, framework-logback, static-framework, static-framework-logback, custom).
      • propertyFileEdits

        @Parameter(defaultValue="${project.basedir}/src/main/karaf/assembly-property-edits.xml")
        protected String propertyFileEdits
        Specify an XML file that instructs this goal to apply edits to one or more standard Karaf property files. The contents of this file are documented in detail on this page. This allows you to customize these files without making copies in your resources directories. Here's a simple example:
         
              <property-edits xmlns="http://karaf.apache.org/tools/property-edits/1.0.0">
                 <edits>
                  <edit>
                    <file>config.properties</file>
                    <operation>put</operation>
                    <key>karaf.framework</key>
                    <value>equinox</value>
                  </edit>
                  <edit>
                    <file>config.properties</file>
                    <operation>extend</operation>
                    <key>org.osgi.framework.system.capabilities</key>
                    <value>my-magic-capability</value>
                  </edit>
                  <edit>
                    <file>config.properties</file>
                    <operation prepend='true'>extend</operation>
                    <key>some-other-list</key>
                    <value>my-value-goes-first</value>
                    </edit>
                 </edits>
              </property-edits>
            
             
      • pidsToExtract

        @Parameter
        protected List<String> pidsToExtract
        Glob specifying which configuration PIDs in the selected boot features should be extracted to ${karaf.etc} directory. By default all PIDs are extracted.
      • translatedUrls

        @Parameter
        protected Map<String,​String> translatedUrls
        Specify a set of translated urls to use instead of downloading the artifacts from their original locations. The given set will be extended with already built artifacts from the maven project.
      • config

        @Parameter
        protected Map<String,​String> config
        Specify a list of additional properties that should be added to ${karaf.etc}/config.properties
      • system

        @Parameter
        protected Map<String,​String> system
        Specify a list of additional properties that should be added to ${karaf.etc}/system.properties
      • reactor

        @Component(role=org.eclipse.aether.repository.WorkspaceReader.class,
                   hint="reactor")
        protected org.eclipse.aether.repository.WorkspaceReader reactor
    • Constructor Detail

      • AssemblyMojo

        public AssemblyMojo()
    • Method Detail

      • 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
      • doExecute

        protected void doExecute()
                          throws Exception
        Main processing method. Most of the work involves configuring and invoking a profile builder.
        Throws:
        Exception