This is an automated email from the ASF dual-hosted git repository. rombert pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/sling-agent-skills.git
commit 7346fb92a9158eee19d84e60a44ff0a5828b548f Author: Robert Munteanu <[email protected]> AuthorDate: Fri Apr 17 17:16:19 2026 +0200 add skill for updating the parent pom --- README.md | 17 ++++ update-sling-parent-pom/SKILL.md | 60 ++++++++++++ .../reference/osgi-annotations.md | 109 +++++++++++++++++++++ update-sling-parent-pom/reference/osgi-r6.md | 4 + update-sling-parent-pom/reference/rat-disable.md | 3 + update-sling-parent-pom/reference/rat-enable.md | 1 + update-sling-parent-pom/reference/servlet-3.md | 3 + 7 files changed, 197 insertions(+) diff --git a/README.md b/README.md new file mode 100644 index 0000000..1e7fdd0 --- /dev/null +++ b/README.md @@ -0,0 +1,17 @@ +# Apache Sling Agent Skills + +A set of [Agent Skills](https://agentskills.io/) for Apache Sling developers and users. + +Current skills: + +- update-sling-parent-pom: Updates the parent POM of a Sling project to the next version. + +## Installation + +Using [npx skills](https://github.com/vercel-labs/skills): + +```bash + npx skills add apache/sling-whiteboard +``` + +Alternatively, clone the repository and copy the skill to a locations supported by your coding assitant. diff --git a/update-sling-parent-pom/SKILL.md b/update-sling-parent-pom/SKILL.md new file mode 100644 index 0000000..6017341 --- /dev/null +++ b/update-sling-parent-pom/SKILL.md @@ -0,0 +1,60 @@ +--- +name: update-sling-parent-pom +description: Use when the user asks to upgrade the Sling parent POM version in their project +--- + +# Updating the Sling Parent POM + +## When to use + +Use when the user asks to upgrade the Sling parent POM version in their project. + +## Instructions + + +- run a full Maven build with the `clean verify`. Use the Java version required by the current parent pom version. If the build fails abort execution and inform the user of the root cause. Do not proceeed, otherwise it is impossible to validate the parent pom upgrade. +- check if any known issues with workarounds exist but to do not remove them +- identify the current version of the Sling parent POM in the user's project +- determine the next available version, typically incrementing by 1. For example, if the version is '22' the next version would be '23' +- update the parent pom version +- run a full Maven build with the `clean verify` goals using the Java version required by the new parent pom version. +- apply additional verification steps as needed if the specific version requires it +- if workarounds were present before updating the parent pom version, check if they can be removed. If they are needed add them back + +Do not touch the git repository state - no staging/unstaging, no commits, no pushes. + +### Java versions + +Different parent pom versions require different Java versions. This is listed in the table below. If building with a certain Java version is needed, use the following commands: + +- Java 8: `mvn8` +- Java 11: `mvn11` +- Java 17: `mvn17` +- Java 21: `mvn21` + +| Parent POM Version | Java Version(s) | Additional fixes needed | +|--------------------|-----------------|-------------------------| +| 22 | 8 | None | +| 23 | 8 | rat-disable | +| 24 | 8 | None | +| 25 | 8 | None | +| 26 | 8 | None | +| 27 | 8 | osgi-r6,servlet-3 | +| 28 | 8 | None | +| 29 | 8 | None | +| 30 | 8 | None | +| 31 | 8 | osgi-annotations | + + +### Additional fixes + +See the following reference files for additional fixes needed to update to a specific parent pom version. + +- rat-disable: [rat-disable.md](./reference/rat-disable.md) +- osgi-r6: [osgi-r6.md](./reference/osgi-r6.md) +- servlet-3: [servlet-3.md](./reference/servlet-3.md) +- osgi-annotations: [osgi-annotations.md](./reference/osgi-annotations.md) + +### Workarounds + +- rat-enable: [rat-enable.md](./reference/rat-enable.md) diff --git a/update-sling-parent-pom/reference/osgi-annotations.md b/update-sling-parent-pom/reference/osgi-annotations.md new file mode 100644 index 0000000..ffbae0d --- /dev/null +++ b/update-sling-parent-pom/reference/osgi-annotations.md @@ -0,0 +1,109 @@ +# OSGi Annotations + +Replace usage of the deprecated Apache Felix SCR annotations with the official OSGi annotations. + +## pom.xml + +Remove the following plugins: +- org.apache.felix:maven-scr-plugin + +Remove the following dependencies: +- org.apache.felix:org.apache.felix.scr.annotations + + +## Java imports + +Imports to remove + +```java +import org.apache.felix.scr.annotations.Activate; +import org.apache.felix.scr.annotations.Component; +import org.apache.felix.scr.annotations.Deactivate; +import org.apache.felix.scr.annotations.Property; +import org.apache.felix.scr.annotations.PropertyUnbounded; +import org.apache.felix.scr.annotations.Reference; +import org.apache.felix.scr.annotations.ReferenceCardinality; +import org.apache.felix.scr.annotations.ReferencePolicy; +import org.apache.felix.scr.annotations.Service; +``` + +Imports to add + +```java +import org.osgi.service.component.annotations.Activate; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Deactivate; +import org.osgi.service.component.annotations.Reference; +import org.osgi.service.component.annotations.ReferenceCardinality; +import org.osgi.service.component.annotations.ReferencePolicy; +import org.osgi.service.metatype.annotations.AttributeDefinition; +import org.osgi.service.metatype.annotations.Designate; +import org.osgi.service.metatype.annotations.ObjectClassDefinition; +``` + +## The @Service annotation + +The `@Service` annotation is no longer needed. Instead, the `service` attribute of the `@Component` annotation should be used to specify the service interfaces. + +Before: + +``java +@Component +@Service(MyService.class) +``` + +After + +```java +@Component(service = MyService.class) +``` + +## The @Property annotation for a top-level class + +The `@Property` annotation is replaced by the 'property' attribute of the `@Component` annotation. + +Before: + +```java +@Component +@Property(name = Constants.SERVICE_DESCRIPTION, value = "Apache Sling MIME Type Service") +``` + +After: + +```java +@Component + property = { + Constants.SERVICE_DESCRIPTION + "=Apache Sling MIME Type Service" + }) +``` + +## The @Properties annotation + +The `@Properties` annotation is replaced by the 'property' attribute of the `@Component` annotation. + +Before: +```java +@Component +@Properties({ + @Property(name = "sling.servlet.extensions", value = "json"), + @Property(name = "sling.servlet.resourceTypes", value = "sling/bar") +}) +``` + +After: +```java +@Component( + property = { + "sling.servlet.extensions=json", + "sling.servlet.resourceTypes=sling/bar" + } +) +``` + +## The ReferenceCardinality enum + +The enum values have changed: + +- OPTIONAL_UNARY → OPTIONAL +- OPTIONAL_MULTIPLE → MULTIPLE diff --git a/update-sling-parent-pom/reference/osgi-r6.md b/update-sling-parent-pom/reference/osgi-r6.md new file mode 100644 index 0000000..3df6be1 --- /dev/null +++ b/update-sling-parent-pom/reference/osgi-r6.md @@ -0,0 +1,4 @@ +Replace the following Maven dependencies + +- org.osgi:org.osgi.core → org.osgi:osgi.core +- org.osgi:org.osgi.compendium → org.osgi:osgi.cmpn diff --git a/update-sling-parent-pom/reference/rat-disable.md b/update-sling-parent-pom/reference/rat-disable.md new file mode 100644 index 0000000..6b0e702 --- /dev/null +++ b/update-sling-parent-pom/reference/rat-disable.md @@ -0,0 +1,3 @@ +The RAT profile was enabled by default with SLING-4511. If this causes failures right after upgrade, you can temporarily disable by running Maven with '-Drat.skip=true'. + +If this succeeds, ask the user if the property should be added to the pom.xml to permanently skip the check. diff --git a/update-sling-parent-pom/reference/rat-enable.md b/update-sling-parent-pom/reference/rat-enable.md new file mode 100644 index 0000000..9ba6d59 --- /dev/null +++ b/update-sling-parent-pom/reference/rat-enable.md @@ -0,0 +1 @@ +If the rat.disable property is set to true in the parent pom, run a Maven build with `-Drat.disable=false`. If the build succeeds, ask the user if the property should be removed from the parent pom. diff --git a/update-sling-parent-pom/reference/servlet-3.md b/update-sling-parent-pom/reference/servlet-3.md new file mode 100644 index 0000000..e40b0dc --- /dev/null +++ b/update-sling-parent-pom/reference/servlet-3.md @@ -0,0 +1,3 @@ +Replace the following Maven dependencies: + +- javax.servlet:servlet-api → javax.servlet:javax.servlet-api
