This is an automated email from the ASF dual-hosted git repository. royteeuwen pushed a commit to branch feature/upgrade-cpconverter-1.3.10 in repository https://gitbox.apache.org/repos/asf/sling-feature-converter-maven-plugin.git
commit e5b3a448fb8db1e2fb4d3a7af3310326b7e8711d Author: Roy Teeuwen <[email protected]> AuthorDate: Tue May 26 21:00:17 2026 +0200 SLING-13216 bump bundled cpconverter to 1.3.10 --- pom.xml | 22 +++++++++++--- .../ui.apps/pom.xml | 3 ++ .../cpconverter/maven/mojos/ConvertCPMojo.java | 34 ++++++++++++++++++---- 3 files changed, 50 insertions(+), 9 deletions(-) diff --git a/pom.xml b/pom.xml index 50355f5..3169441 100644 --- a/pom.xml +++ b/pom.xml @@ -39,8 +39,8 @@ <properties> <sling.java.version>11</sling.java.version> <plexus-component-metadata.version>2.2.0</plexus-component-metadata.version> - <javax.json.version>1.0.4</javax.json.version> - <org.apache.jackrabbit.vault.version>3.2.8</org.apache.jackrabbit.vault.version> + <javax.json.version>1.1.4</javax.json.version> + <org.apache.jackrabbit.vault.version>3.6.8</org.apache.jackrabbit.vault.version> <maven.version>3.8.1</maven.version> <maven.scm.version>1.11.1</maven.scm.version> <maven-artifact-transfer.version>0.11.0</maven-artifact-transfer.version> @@ -77,8 +77,22 @@ <dependency> <groupId>org.apache.sling</groupId> <artifactId>org.apache.sling.feature.cpconverter</artifactId> - <version>1.0.24</version> + <version>1.3.10</version> <scope>compile</scope> + <exclusions> + <!-- + cpconverter 1.3.10 pulls in jackrabbit-api transitively via + org.apache.sling.jcr.contentparser:1.2.6. The project parent's + ban-plugins-and-dependencies enforcer rule rejects jackrabbit-api + (OAK-8339: superseded by org.apache.jackrabbit:oak-jackrabbit-api). + cpconverter itself does not USE jackrabbit-api classes, so we can + safely drop the transitive without functional impact. + --> + <exclusion> + <groupId>org.apache.jackrabbit</groupId> + <artifactId>jackrabbit-api</artifactId> + </exclusion> + </exclusions> </dependency> <dependency> <groupId>org.apache.sling</groupId> @@ -89,7 +103,7 @@ <dependency> <groupId>org.apache.sling</groupId> <artifactId>org.apache.sling.feature</artifactId> - <version>1.2.18</version> + <version>2.0.4</version> <scope>compile</scope> </dependency> <dependency> diff --git a/src/it/package-with-single-bundle-with-parameters/ui.apps/pom.xml b/src/it/package-with-single-bundle-with-parameters/ui.apps/pom.xml index 5f4806c..cfa2441 100644 --- a/src/it/package-with-single-bundle-with-parameters/ui.apps/pom.xml +++ b/src/it/package-with-single-bundle-with-parameters/ui.apps/pom.xml @@ -83,6 +83,9 @@ <!-- On some systems the trick with the zero-width (​) space does not work so we do test it w/o place holders --> <artifactIdOverride>${project.groupId}:${project.artifactId}:slingosgifeature:@project.artifactId@:${project.version}</artifactIdOverride> <installConvertedPackage>true</installConvertedPackage> + <!-- Exercise the slingInitialContentPolicy parameter. KEEP matches the default, + so this asserts the parameter is at least accepted and recognised. --> + <slingInitialContentPolicy>KEEP</slingInitialContentPolicy> </configuration> </execution> </executions> diff --git a/src/main/java/org/apache/sling/cpconverter/maven/mojos/ConvertCPMojo.java b/src/main/java/org/apache/sling/cpconverter/maven/mojos/ConvertCPMojo.java index 8182c89..eee55f8 100644 --- a/src/main/java/org/apache/sling/cpconverter/maven/mojos/ConvertCPMojo.java +++ b/src/main/java/org/apache/sling/cpconverter/maven/mojos/ConvertCPMojo.java @@ -40,8 +40,10 @@ import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.project.ProjectBuildingRequest; import org.apache.maven.shared.transfer.artifact.install.ArtifactInstallerException; import org.apache.sling.feature.cpconverter.ContentPackage2FeatureModelConverter; +import org.apache.sling.feature.cpconverter.ContentPackage2FeatureModelConverter.SlingInitialContentPolicy; +import org.apache.sling.feature.cpconverter.accesscontrol.AclManager; import org.apache.sling.feature.cpconverter.accesscontrol.DefaultAclManager; -import org.apache.sling.feature.cpconverter.artifacts.DefaultArtifactsDeployer; +import org.apache.sling.feature.cpconverter.artifacts.LocalMavenRepositoryArtifactsDeployer; import org.apache.sling.feature.cpconverter.features.DefaultFeaturesManager; import org.apache.sling.feature.cpconverter.filtering.RegexBasedResourceFilter; import org.apache.sling.feature.cpconverter.filtering.ResourceFilter; @@ -89,6 +91,8 @@ public class ConvertCPMojo extends AbstractBaseMojo { public static final String CFG_FILTER_PATTERNS = "filterPatterns"; + public static final String CFG_SLING_INITIAL_CONTENT_POLICY = "slingInitialContentPolicy"; + public static final boolean DEFAULT_STRING_VALIDATION = false; public static final boolean DEFAULT_MERGE_CONFIGURATIONS = false; @@ -189,6 +193,18 @@ public class ConvertCPMojo extends AbstractBaseMojo { @Parameter(property = CFG_FILTER_PATTERNS) private List<String> filterPatterns; + /** + * Controls how cpconverter handles a bundle's {@code Sling-Initial-Content} header: + * {@link SlingInitialContentPolicy#KEEP} (default) keeps the initial content inside + * the bundle and does not extract it, matching the pre-1.1.x behaviour; + * {@link SlingInitialContentPolicy#EXTRACT_AND_REMOVE} extracts the initial content + * into content-packages and the feature model and removes it from the bundle; + * {@link SlingInitialContentPolicy#EXTRACT_AND_KEEP} does the same but additionally + * keeps the original content inside the bundle. + */ + @Parameter(property = CFG_SLING_INITIAL_CONTENT_POLICY, defaultValue = "KEEP") + private SlingInitialContentPolicy slingInitialContentPolicy; + @Parameter(defaultValue = "${repositorySystemSession}") private RepositorySystemSession repoSession; @@ -223,17 +239,25 @@ public class ConvertCPMojo extends AbstractBaseMojo { } } try { + AclManager aclManager = new DefaultAclManager(); DefaultFeaturesManager featuresManager = new DefaultFeaturesManager( - mergeConfigurations, bundleStartOrder, fmOutput, artifactIdOverride, fmPrefix, properties); + mergeConfigurations, + bundleStartOrder, + fmOutput, + artifactIdOverride, + fmPrefix, + properties, + aclManager); if (!apiRegions.isEmpty()) featuresManager.setAPIRegions(apiRegions); if (exportToApiRegion != null) featuresManager.setExportToAPIRegion(exportToApiRegion); - ContentPackage2FeatureModelConverter converter = new ContentPackage2FeatureModelConverter(strictValidation) + ContentPackage2FeatureModelConverter converter = new ContentPackage2FeatureModelConverter( + strictValidation, slingInitialContentPolicy) .setFeaturesManager(featuresManager) - .setBundlesDeployer(new DefaultArtifactsDeployer(convertedCPOutput)) + .setBundlesDeployer(new LocalMavenRepositoryArtifactsDeployer(convertedCPOutput)) .setEntryHandlersManager(new DefaultEntryHandlersManager()) - .setAclManager(new DefaultAclManager()) + .setAclManager(aclManager) .setEmitter(DefaultPackagesEventsEmitter.open(fmOutput)) .setResourceFilter(getResourceFilter());
