Arthur Logo Apache Geronimo Arthur
  • Apache
  • Documentation
  • Community
  • Downloads
  • ASF
    License Sponsorship Thanks
    Security

Arthur Winegrower Knights

Arthur Winegrower knight is responsible to support Winegrower. It preconfigures the reflection and resource inclusion.

It generally assumes you have winegrower-core in your project dependencies. Here is a sample dependencies block for a simple SCR application:

<dependencies>
  <dependency>
    <groupId>org.osgi</groupId>
    <artifactId>osgi.core</artifactId>
    <version>${osgi.version}</version>
  </dependency>
  <dependency>
    <groupId>org.osgi</groupId>
    <artifactId>osgi.cmpn</artifactId>
    <version>${osgi.version}</version>
  </dependency>
  <dependency>
    <groupId>org.apache.felix</groupId>
    <artifactId>org.apache.felix.scr</artifactId>
    <version>${felix-scr.version}</version>
  </dependency>
  <dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-simple</artifactId>
    <version>${slf4j.version}</version>
  </dependency>
  <dependency>
    <groupId>org.apache.winegrower</groupId>
    <artifactId>winegrower-core</artifactId>
    <version>${winegrower.version}</version>
  </dependency>
</dependencies>

Coordinates

<dependency>
  <groupId>org.apache.geronimo.arthur.knights</groupId>
  <artifactId>winegrower-knight</artifactId>
  <version>${arthur.version}</version>
</dependency>

Usage

To make a winegrower application compatible with native-image there are a few necessary steps to do:

  1. Ensure OSGi metadata (SCR, blueprint etc) descriptors are generated,

  2. Ensure Winegrower runs in metadata mode, i.e. it does not require to inspect files anymore to find MANIFEST.MF files and OSGI-INF descriptors,

  3. Ensure the SCR, blueprint, …​ reflection model is registered.

The winegrower-knight handles all but the first point which is still done through bnd-tool or maven-bundle-plugin. Here is a definition to generate the META-INF/MANIFEST.MF correctly:

<plugin>
  <groupId>org.apache.felix</groupId>
  <artifactId>maven-bundle-plugin</artifactId>
  <version>${maven-bundle.version}</version>
  <extensions>true</extensions>
  <executions>
    <execution>
      <id>manifest</id>
      <phase>process-classes</phase>
      <goals>
        <goal>bundle</goal>
      </goals>
      <configuration>
        <exportScr>true</exportScr>
      </configuration>
    </execution>
  </executions>
</plugin>

Then, to generate winegrower metadata you can either use the related plugin or let the extension do (default). If you decide to use the plugin you must define it like that:

<plugin>
  <groupId>org.apache.winegrower</groupId>
  <artifactId>winegrower-maven-plugin</artifactId>
  <version>${winegrower.version}</version>
  <executions>
    <execution>
      <id>metadata</id>
      <phase>process-classes</phase>
      <goals>
        <goal>metadata</goal>
      </goals>
      <configuration>
        <autoFiltering>true</autoFiltering> <!-- enables to reduce the number of generated metadata, it is generally enough -->
        <excludeArtifacts> <!-- xbean will be in the classpath but not needed by most applications -->
          <excludeArtifact>xbean-finder-shaded</excludeArtifact>
        </excludeArtifacts>
      </configuration>
    </execution>
  </executions>
</plugin>

And to deactivate the extension metadata generation you must add an extension property:

<plugin>
  <groupId>${project.groupId}</groupId>
  <artifactId>arthur-maven-plugin</artifactId>
  <version>${project.version}</version>
  <configuration>
    <!-- .... -->
    <extensionProperties>
      <extension.winegrower.metadata.generate>false</extension.winegrower.metadata.generate>
    </extensionProperties>
  </configuration>
</plugin>

Finally, whatever way you picked to generate metadata, you must register the winegrower knight in arthur-maven-plugin:

<plugin>
  <groupId>org.apache.geronimo.arthur</groupId>
  <artifactId>arthur-maven-plugin</artifactId>
  <version>${arthur.version}</version>
  <configuration>
    <main>org.company.osgi.ScrMain</main>
    <graalExtensions>
      <graalExtension>winegrower</graalExtension>
    </graalExtensions>
  </configuration>
</plugin>

Configuration

This knight has several configuration options:

Name Type Description

extension.winegrower.[includes|excludes]

String

Comma separated values for scanning filter. It acts on the filename and matches prefixes.

extension.winegrower.metadata.generate

boolean

Should the winegrower metadata be automatically generated, default to true.

extension.winegrower.metadata.autoFiltering

boolean

Should winegrower metadata generation use autofiltering to reduce the number of metadata, default to true.

extension.winegrower.metadata.defaultJarName

String

What name to use for the exploded classpath folder of the module (target/classes), default to module folder name.


Previous: Knights

Copyright © 1999-2021 The Apache Software Foundation, Licensed under the Apache License, Version 2.0. Apache Geronimo, Geronimo, Apache, the Apache feather logo, and the Apache Geronimo project logo are trademarks of The Apache Software Foundation. All other marks mentioned may be trademarks or registered trademarks of their respective owners.