SLING-10695 : Create analyser to check for paths in content packages
7 files changed
tree: d9ed8070aa2b3554dfffd056c617c199a1471222
  1. src/
  2. .asf.yaml
  3. .gitignore
  4. bnd.bnd
  5. CODE_OF_CONDUCT.md
  6. CONTRIBUTING.md
  7. Jenkinsfile
  8. LICENSE
  9. pom.xml
  10. readme.md
readme.md

Apache Sling

Build Status Test Status Coverage Sonarcloud Status JavaDoc Maven Central feature License

Feature Model Analyser

The Analyser can analyse features for completeness and correctness. The analyser is pluggable and can also perform other checks.

The analyser can be run from the commandline by running the following main class:

java org.apache.sling.feature.analyser.main.Main

Feature Model Analyser as a Maven Plugin

The Analyser can also be run as part of a maven build via the slingfeature-maven-plugin

The following analysers are defined:

  • bundle-packages: Checks bundle import/export package statements for consistency and completeness. Does not take API Regions into account. An expanded variant of this analyser is available in org-apache-sling-feature-extension-apiregions under the name api-regions-exportsimports.

  • bundle-content: Gives a warning if a bundle container initial content specified with Sling-Initial-Content.

  • bundle-resources: Gives a warning if a bundle contains resources specified with Sling-Bundle-Resources.

  • compare-features: Compares the artifacts in the bundles sections or in an extension between two feature models. For more information see below.

  • requirements-capabilities: Checks bundle requirements/capabilities for consistency and completeness.

  • apis-jar: Validates that the entries related to Apis Jar are valid.

  • repoinit: Checks the syntax of all repoinit sections.

  • feature-id: Checks if the used feature id matches one of the given Maven coordinates.

Additional analysers in relation to Feature Model API Regions can be found here: org-apache-sling-feature-extension-apiregions

For further documentation see: Feature Model

compare-features

This analyser compares certain sections of two feature models.

This analyser requires additional configuration:

Configuration keyAllowed valuesDescription
compare-typeARTIFACTSThe types of entities being compared. Currently only artifacts can be compared.
compare-withMaven ID, e.g. mygroup:myart:1.2.3The golden feature to compare the features selected for the analyser with.
compare-extensionextension nameIf this configuration is absent, the feature's bundles are compared. Otherwise the extensions with the specified name are compared. These extensions must be of type ARTIFACTS.
compare-modeSAME or DIFFERENTWhether the sections must be the same or must be different. Defaults to SAME.
compare-metadatatrue or falseWhether to include the artifact metadata in the comparison. Defaults to false.

feature-id

This analyser checks that the feature id matches one of the given accepted feature ids. If it doesn't it will emit an error.

This analyser requires additional configuration:

Configuration keyAllowed valuesDescription
accepted-feature-idscomma-separated list of Maven IDsThe Maven ID/coordinates have the format groupId:artifactId[:packaging[:classifier]]:version. Each item is either a string which must be equal to the according item of the feature id, or a * which acts as wildcard (i.e. everything matches).

content-packages-paths

This analyser checks for allowed and denied paths inside content packages. This analyser requires additional configuration:

Configuration keyAllowed valuesDescription
includesContent pathsA comma separated list of content paths. If this is specified all content in the content package must match at least one of these.
excludesContent pathsA comma separated list of content paths. If this is specified all content in the contant package must not match any of these.