Apache Sling JCR Resource
July 16, 2026 ยท View on GitHub
Apache Sling JCR Resource
This module is part of the Apache Sling project.
This bundle provides Sling's JCR-backed resource provider and resolver internals.
It maps JCR nodes and properties to Sling Resource objects, handles provider/session lifecycle, supports query and binary download integrations, exposes JCR-backed ValueMap implementations, and emits resource change events from JCR observation.
Build and test
# Build and package (skip tests)
mvn clean package -DskipTests
# Full build (including tests)
mvn clean install
# Run all tests
mvn test
# Run a single test class
mvn test -Dtest=JcrResourceProviderTest
# Run session lifecycle/provider handling tests
mvn test -Dtest=JcrResourceProviderSessionHandlingTest
# Run a single test method
mvn test -Dtest=JcrValueMapTest#testPutMultipleValues
# Generate coverage report
mvn test jacoco:report
Development checks
# Apply formatting
mvn spotless:apply
# Check formatting
mvn spotless:check
# Verify license headers
mvn apache-rat:check
# Check API baseline compatibility
mvn bnd-baseline:baseline
Repository layout
pom.xml Maven build descriptor
bnd.bnd OSGi metadata and package instructions
src/
main/
java/org/apache/sling/jcr/resource/
api/ Public API (JcrResourceChange, JcrResourceConstants)
internal/ Internal implementation
helper/ Conversion utilities, cache entry, access logging, lazy streams
helper/jcr/ Core JCR ResourceProvider, provider state, query/binary support
scripting/ Optional scripting bindings integration
resources/SLING-INF/nodetypes/
Sling/JCR node type definitions (folder, resource, vanitypath, redirect, mapping)
test/
java/ JUnit 4 tests plus shared test infrastructure
target/ Build output (generated classes, OSGI-INF, SLING-INF, surefire-reports, baseline report)
Includes generated-sources/annotations and generated-test-sources/test-annotations
Key technical details
- Java source/target level is Java 8 (
sling.java.version=8). - Parent POM is
org.apache.sling:sling-bundle-parent:66. - Current artifact development version is
3.3.7-SNAPSHOT. - Oak baseline is
1.44.0(minimum required forJackrabbitNode.getPropertyOrNullsupport). - Jackrabbit baseline is
2.18.0. org.apache.sling.scripting.apiis optional at runtime (resolution:=optionalinbnd.bnd).- Adapter metadata is generated by
sling-maven-pluginduringprocess-classes. org.apache.jackrabbit.utilandorg.apache.jackrabbit.nameare embedded via-conditionalpackage.- Bundle nodetypes are provided from
src/main/resources/SLING-INF/nodetypes/(folder.cnd,resource.cnd,vanitypath.cnd,redirect.cnd,mapping.cnd).
