adobe / adobe/aem-project-archetype

Context-Aware Configuration does not work

Open
#971 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
596
Forks
431
Avg merge
10d 6h
Merged PRs (30d)
1

Description

### Expected Behaviour
a Sling Context-Aware configuration can be used

### Actual Behaviour
An interface annotated as `org.apache.sling.caconfig.annotation.Configuration` is not found by the bnd-process

The issue can be fixed, if the **current** bnd-configuration (main pom.xml)

# does NOT work
-plugin org.apache.sling.caconfig.bndplugin.ConfigurationClassScannerPlugin
-plugin org.apache.sling.bnd.models.ModelsScannerPlugin

is changed to

# does work
-plugin.caconfig org.apache.sling.caconfig.bndplugin.ConfigurationClassScannerPlugin
-plugin.models org.apache.sling.bnd.models.ModelsScannerPlugin

see merged bnd-instructions (chapter 33.2 Merged Instructions at https://bnd.bndtools.org/chapters/820-instructions.html)

alternatively all plugins can be specified in a single line

# works too
-plugin org.apache.sling.caconfig.bndplugin.ConfigurationClassScannerPlugin,org.apache.sling.bnd.models.ModelsScannerPlugin

In the current version only the ModelsScannerPlugin is used. By changing the order of the lines, only the ConfigurationClassScannerPlugin is used. So the last -plugin instruction wins.

#### Steps to Reproduce
Add a Context-aware configuration to core, and the built bundle should have 2 Manifest-Headers

- Sling-ContextAware-Configuration-Classes:
- Sling-Model-Classes:

#### Platform and Version
AEMaaCS, MacOS w. M1 chip - but probably all platforms

PS: I could create a Pull-Request, which also includes a sample CA-Config.

kind regards,
Alexander Berndt

Contributor guide

Open the contributing guide

Research direction

Start with the current bnd configuration in the main pom.xml and compare it with the merged-instructions behavior described in the issue. Add a context-aware configuration to core and verify that the built bundle contains both Sling-ContextAware-Configuration-Classes and Sling-Model-Classes manifest headers.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.