Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Register non-standard namespaces used in Sling Initial Content via Sling-Namespaces header #10

Closed
kwin opened this issue Jan 31, 2023 · 7 comments · Fixed by #11
Closed

Comments

@kwin
Copy link
Contributor

kwin commented Jan 31, 2023

The Sling Initial Content given in

uses a non-standard namespace prefix (from a cp2fm point of view), namely cq: which leads to the following warning with cp2fm used in aemanalyser-maven-plugin:

[WARNING] [content-packages-validation] io.wcm:io.wcm.caconfig.editor-apps:zip:cp2fm-converted:1.13.0: ValidationViolation: "jackrabbit-docviewparser: Could not parse FileVault Document View XML: The prefix "cq" for attribute "cq:defaultView" associated with an element type "jcr:root" is not bound.", filePath=jcr_root/apps/wcm-io/caconfig/editor/components/page/editor/.content.xml, nodePath=/apps/wcm-io/caconfig/editor/components/page/editor, line=2, column=478

As cp2fm evaluates the Sling-Namespaces bundle header as defined by https://sling.apache.org/documentation/bundles/content-loading-jcr-contentloader.html#node-type-and-namespace-definitions-cnd in https://github.com/apache/sling-org-apache-sling-feature-cpconverter/blob/446396afa93b3f8684816b73617647637e5fe17b/src/main/java/org/apache/sling/feature/cpconverter/handlers/slinginitialcontent/JcrNamespaceRegistryProvider.java#L72, that prefix should be explicitly registered in the bundle header.

kwin added a commit to kwin/io.wcm.caconfig.editor that referenced this issue Feb 1, 2023
kwin added a commit to kwin/io.wcm.caconfig.editor that referenced this issue Feb 1, 2023
kwin added a commit to kwin/io.wcm.caconfig.editor that referenced this issue Feb 1, 2023
@stefanseifert
Copy link
Member

thanks for the contribution! changes from the PR make sense.

however, i wanted to test the validation with aemanalyser-maven-plugin before and after this change - and was not able to see the warning you have mentioned above. do i need to specify other (more recent) dependencies for the plugin to see them? i would like to validate this in other wcm.io modules as well.

@kwin
Copy link
Contributor Author

kwin commented Feb 15, 2023

I get the following warning in a container content package embedding io.wcm:io.wcm.caconfig.editor:1.13.0

[INFO] --- aemanalyser:1.5.8:project-analyse (analyser) @ my-all-container ---
...
[INFO] Using detected SDK Version for analysis: com.adobe.aem:aem-sdk-api:2023.1.10675.20230113T110236Z-220900
...
[WARNING] [content-packages-validation] io.wcm:io.wcm.caconfig.editor-apps:zip:cp2fm-converted:1.13.0: ValidationViolation: "jackrabbit-docviewparser: Could not parse FileVault Document View XML: The prefix "cq" for attribute "cq:defaultView" associated with an element type "jcr:root" is not bound.", filePath=jcr_root/apps/wcm-io/caconfig/editor/components/page/editor/.content.xml, nodePath=/apps/wcm-io/caconfig/editor/components/page/editor, line=2, column=478

@stefanseifert
Copy link
Member

i'm still failing to see this warning - in whatever way i include caconfig editor in the all package.

to reproduce i've created a git project based on adobe AEM project archetype 40:
https://github.com/stefanseifert/aemanalyser-maven-plugin-issues

it contains two branches, one with embedding caconfig editor directly in the archetype (which is imho the recommended way), or indirectly via a container package as described in your comment. the branches use latest caconfig editor release 1.15.2, but it is also not reproducible with 1.13.0.

is there something additional configured in your project?

@kwin
Copy link
Contributor Author

kwin commented Feb 20, 2023

Hm, I see the following warning on your repository (branch embed-directly)

...
[INFO] --- aemanalyser:1.5.8:project-analyse (aem-analyser) @ mysite.all ---
...
[INFO] - Executing Bundle Resources Check [bundle-resources]...
[INFO] - Executed Bundle Resources Check [bundle-resources] in 0ms
[INFO] - Executing Content Package validation [content-packages-validation]...
[INFO] Using 1 validators for package of type CONTAINER: jackrabbit-docviewparser (org.apache.jackrabbit.vault.validation.spi.impl.DocumentViewParserValidator)
[INFO] Using 1 validators for package of type APPLICATION: jackrabbit-docviewparser (org.apache.jackrabbit.vault.validation.spi.impl.DocumentViewParserValidator)
[INFO] Using 1 validators for package of type APPLICATION: jackrabbit-docviewparser (org.apache.jackrabbit.vault.validation.spi.impl.DocumentViewParserValidator)
[INFO] Using 1 validators for package of type CONTAINER: jackrabbit-docviewparser (org.apache.jackrabbit.vault.validation.spi.impl.DocumentViewParserValidator)
[INFO] Using 1 validators for package of type APPLICATION: jackrabbit-docviewparser (org.apache.jackrabbit.vault.validation.spi.impl.DocumentViewParserValidator)
[WARNING] ValidationViolation: "jackrabbit-docviewparser: Could not parse FileVault Document View XML: The prefix "cq" for attribute "cq:defaultView" associated with an element type "jcr:root" is not bound.", filePath=jcr_root/apps/wcm-io/caconfig/editor/components/page/editor/.content.xml, nodePath=/apps/wcm-io/caconfig/editor/components/page/editor, line=2, column=478
[INFO] - Executed Content Package validation [content-packages-validation] in 94ms
...
[INFO] - Executing Region Deprecated API analyser task [region-deprecated-api]...
[INFO] - Executed Region Deprecated API analyser task [region-deprecated-api] in 24ms
[INFO] - Executing Requirements Capabilities check [requirements-capabilities]...
[INFO] - Executed Requirements Capabilities check [requirements-capabilities] in 313ms
[INFO] Analyzing feature 'com.mysite:mysite.all:slingosgifeature:aggregated-author:1.0.0-SNAPSHOT' finished : 0 warnings, 0 errors.
[WARNING] The analyser found the following warnings for author and publish : 
[WARNING] [content-packages-validation] io.wcm:io.wcm.caconfig.editor-apps:zip:cp2fm-converted:1.15.2: ValidationViolation: "jackrabbit-docviewparser: Could not parse FileVault Document View XML: The prefix "cq" for attribute "cq:defaultView" associated with an element type "jcr:root" is not bound.", filePath=jcr_root/apps/wcm-io/caconfig/editor/components/page/editor/.content.xml, nodePath=/apps/wcm-io/caconfig/editor/components/page/editor, line=2, column=478
[INFO] 

This is with

mvn -v
Apache Maven 3.9.0 (9b58d2bad23a66be161c4664ef21ce219c2c8584)
Maven home: /opt/homebrew/Cellar/maven/3.9.0/libexec
Java version: 11.0.18, vendor: Eclipse Adoptium, runtime: /Library/Java/JavaVirtualMachines/temurin-11.jdk/Contents/Home
Default locale: en_DE, platform encoding: UTF-8
OS name: "mac os x", version: "12.6.3", arch: "aarch64", family: "mac"

Here is the full log for the all module: mvn.log

@stefanseifert
Copy link
Member

stefanseifert commented Feb 23, 2023

@kwin i see the warning when building under linux - but not on windows! although the same plugin versions and same project is used. i assume the maven version does not play a role.

on windows i'm missing those lines (marked with ">"):

...
[INFO] Reading 'io.wcm.caconfig.editor-1.15.2' bundle GAV from META-INF/maven/io.wcm/io.wcm.caconfig.editor/pom.xml...
> [INFO] Created package io.wcm:io.wcm.caconfig.editor-apps:1.15.2 out of Sling-Initial-Content from 'io.wcm:io.wcm.caconfig.editor:1.15.2'
> [INFO] Checking if other io.wcm:io.wcm.caconfig.editor-apps content-package versions were handled already
> [INFO] There were not other version of io.wcm:io.wcm.caconfig.editor-apps content-package
...
[INFO] Using 1 validators for package of type CONTAINER: jackrabbit-docviewparser (org.apache.jackrabbit.vault.validation.spi.impl.DocumentViewParserValidator)
[INFO] Using 1 validators for package of type APPLICATION: jackrabbit-docviewparser (org.apache.jackrabbit.vault.validation.spi.impl.DocumentViewParserValidator)
[INFO] Using 1 validators for package of type APPLICATION: jackrabbit-docviewparser (org.apache.jackrabbit.vault.validation.spi.impl.DocumentViewParserValidator)
[INFO] Using 1 validators for package of type CONTAINER: jackrabbit-docviewparser (org.apache.jackrabbit.vault.validation.spi.impl.DocumentViewParserValidator)
> [INFO] Using 1 validators for package of type APPLICATION: jackrabbit-docviewparser (org.apache.jackrabbit.vault.validation.spi.impl.DocumentViewParserValidator)
> [WARNING] ValidationViolation: "jackrabbit-docviewparser: Could not parse FileVault Document View XML: The prefix "cq" for attribute "cq:defaultView" associated with an element type "jcr:root" is not bound.", filePath=jcr_root/apps/wcm-io/caconfig/editor/components/page/editor/.content.xml, nodePath=/apps/wcm-io/caconfig/editor/components/page/editor, line=2, column=478
[INFO] - Executed Content Package validation [content-packages-validation] in 163ms
...
[INFO] Analyzing feature 'com.mysite:mysite.all:slingosgifeature:aggregated-author:1.0.0-SNAPSHOT' finished : 0 warnings, 0 errors.
> [WARNING] The analyser found the following warnings for author and publish : 
> [WARNING] [content-packages-validation] io.wcm:io.wcm.caconfig.editor-apps:zip:cp2fm-converted:1.15.2: ValidationViolation: "jackrabbit-docviewparser: Could not parse FileVault Document View XML: The prefix "cq" for attribute "cq:defaultView" associated with an element type "jcr:root" is not bound.", filePath=jcr_root/apps/wcm-io/caconfig/editor/components/page/editor/.content.xml, nodePath=/apps/wcm-io/caconfig/editor/components/page/editor, line=2, column=478

it seems there is an issue in aemanalyser or used dependencies that prevents them from being executed on windows - likely another slash-backslash-issue.

environments used - windows:

Apache Maven 3.8.4 (9b656c72d54e5bacbed989b64718c159fe39b537)
Maven home: C:\java\apache-maven-3.8.4
Java version: 11.0.17, vendor: Oracle Corporation, runtime: C:\java\jdk-11.0.17
Default locale: de_DE, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

linux VM:

Apache Maven 3.6.0
Maven home: /usr/share/maven
Java version: 11.0.16, vendor: Ubuntu, runtime: /usr/lib/jvm/java-11-openjdk-amd64
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "4.15.0-58-generic", arch: "amd64", family: "unix"

@kwin
Copy link
Contributor Author

kwin commented Feb 23, 2023

Looks like an issue inside cp2fm. Please report at Sling. Probably related to https://issues.apache.org/jira/browse/SLING-11616 where I mentioned you :-)

@stefanseifert
Copy link
Member

now i'm able to reproduce it locally, thx for the fix
i will apply the same fix to various other wcm.io bundles which are affected as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants