Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

No Format
...
<Include-Resource>
    src/main/resources,
    target/scr-plugin-generated
</Include-Resource>
<Service-Component>
  OSGI-INF/serviceComponents.xml
</Service-Component>
...

Annotations

The maven-scr-plugin uses the SCR annotations from the corresponding subproject at Apache Felix. All annotations are in the org.apache.felix.scr.annotations package. If you want to use the annotations in your project, make sure that you add a dependency to the annotations to your POM:

No Format

<dependency>
    <groupId>org.apache.felix</groupId>
    <artifactId>org.apache.felix.scr.annotations</artifactId>
    <version>1.0.0</version>
</dependency>

The following annotations are supported:

Anchor
scran.component
scran.component

Component

The Component annotation is the only required annotation. If this annotation is not declared for a Java class, the class is not declared as a component.

This annotation is used to declare the <component> element of the component declaration. See section 112.4.3, Component Element, in the OSGi Service Platform Service Compendium Specification for more information. The required <implementation> element is automatically generated with the fully qualified name of the class containing the Component annotation.

Supported attributes:

Name

Default Value

Required

SCR

Metatype

Description

name

Fully qualified name of the Java class

no

component.name

OCD.id

Defines the Component name also used as the PID for the Configuration Admin Service

ds

true

no

Whether Declarative Services descriptor is generated or not. If this parameter is not set or set to true the Declarative Services descriptor is generated in the service descriptor file for this component. Otherwise no Declarative Services descriptor is generated for this component.

abstract

see description

no

This marks an abstract service description which is not added to the descriptor but intended for reuse through inheritance. This attribute defaults to true for abstract classes and false for concrete classes.

enabled

true

no

component.enabled

Whether the component is enabled when the bundle starts

factory

no

component.factory

Whether the component is a factory component

immediate

no

component.immediate

Whether the component is immediately activated

inherit

true

no

Whether any service, property and reference declarations from base classes should be inherited by this class.

metatype

true

no

Whether Metatype Service data is generated or not. If this parameter is not set or set to true Metatype Service data is generated in the metatype.xml file for this component. Otherwise no Metatype Service data is generated for this component.

label

%<name>.name

no

OCD.name

This is generally used as a title for the object described by the meta type. This name may be localized by prepending a % sign to the name.

description

%<name>.name

no

OCD.description

This is generally used as a description for the object described by the meta type. This name may be localized by prepending a % sign to the name.

JavaDoc tags

The scr goal of the maven-scr-plugin looks for the following JavaDoc tags when building component descriptors:

...