WebJar Node Maven Handler

Last modified by Manuel Leduc on 2025/06/27 10:26

XWiki 17.5.0+

Similarly to the WebJar Maven Handler, the Webjar Node Maven Handler helps to build webjar packages, using node and npm to build the artifacts.

To do the, the pom must declare a webjar-node packaging. This handler automates all the plumbing required to make a webjar using node.

Pom example:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>org.xwiki.platform</groupId>
    <artifactId>xwiki-platform-livedata</artifactId>
    <version>17.6.0-SNAPSHOT</version>
  </parent>
  <packaging>webjar-node</packaging>
  <artifactId>xwiki-platform-livedata-webjar</artifactId>
</projectr>

Notes:

  • the node project must be located in src/main/node
  • the package.json must declare
    • a build script to build the artifacts from the sources
    • a test:unit script to run the unit tests
    • a lint script to check the code quality
    • the sources copied into the webjar must be in a dist directory at the root of the node project

Get Connected