Hello,
I’m trying to implement a custom rendering macro following the official documentation:
https://rendering.xwiki.org/xwiki/bin/view/Main/ExtendingMacro
According to the documentation, the macro implementation should import:
import org.xwiki.rendering.transformation.MacroTransformationContext;
However, when I add this import, I get a compilation error stating that
MacroTransformationContext cannot be resolved / does not exist.
Context / Environment
XWiki version: 17.4.7
Java: 17
What I’ve tried
I added the XWiki public repository and explicitly declared what I believe are all relevant rendering and macro-related dependencies.
Here is my current pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example.xwiki</groupId>
<artifactId>xwiki-layout-macro</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<repositories>
<repository>
<id>xwiki-public</id>
<url>https://nexus.xwiki.org/nexus/content/groups/public/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.xwiki.rendering</groupId>
<artifactId>xwiki-rendering-api</artifactId>
<version>17.4.7</version>
</dependency>
<dependency>
<groupId>org.xwiki.rendering</groupId>
<artifactId>xwiki-rendering-macro-content</artifactId>
<version>17.4.7</version>
</dependency>
<dependency>
<groupId>org.xwiki.rendering</groupId>
<artifactId>xwiki-rendering-macro-html</artifactId>
<version>17.4.7</version>
</dependency>
<dependency>
<groupId>org.xwiki.platform</groupId>
<artifactId>xwiki-platform-rendering-transformation-macro</artifactId>
<version>17.4.7</version>
</dependency>
<dependency>
<groupId>org.xwiki.rendering</groupId>
<artifactId>xwiki-rendering-transformation-macro</artifactId>
<version>17.4.7</version>
</dependency>
<dependency>
<groupId>org.xwiki.rendering</groupId>
<artifactId>xwiki-rendering-macro-id</artifactId>
<version>17.4.7</version>
</dependency>
<dependency>
<groupId>jakarta.inject</groupId>
<artifactId>jakarta.inject-api</artifactId>
<version>2.0.1</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>2.0.13</version>
</dependency>
</dependencies>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
</properties>
</project>
Despite this, the class
org.xwiki.rendering.transformation.MacroTransformationContext
is still missing.
Question
- Has MacroTransformationContext been removed, renamed, or moved in recent XWiki versions?
- Is the documentation outdated for XWiki 17.x?
- What is the correct replacement or recommended approach when implementing a macro today?
Any clarification or pointers to up-to-date examples would be greatly appreciated.
Thanks in advance!