Extension Maven Plugin

Last modified by Thomas Mortagne on 2021/09/21 11:07

Various extension-oriented mojos for Maven builds.

WAR Mojo

Generate a complete extension descriptor (.xed file) for all the jars packaged in a WAR (next to each one) as well as for the WAR itself (in /META-INF/).

To execute it:

      <plugin>
       <groupId>org.xwiki.commons</groupId>
       <artifactId>xwiki-commons-tool-extension-plugin</artifactId>
       <executions>
         <execution>
           <goals>
             <goal>war</goal>
           </goals>
         </execution>
       </executions>
     </plugin>

Register Mojo

Generate complete extension descriptor (.xed file) for the current artifact in /META-INF/.

      <plugin>
       <groupId>org.xwiki.commons</groupId>
       <artifactId>xwiki-commons-tool-extension-plugin</artifactId>
       <executions>
         <execution>
           <goals>
             <goal>register</goal>
           </goals>
         </execution>
       </executions>
     </plugin>

XIP Mojo and extension

Generate a xip package (a zip file containing extensions formatted like the local extensions repository) containing the dependencies of the current project by default. It's mostly used in conjunction with xip extensions as a packaging tool.

To use it:

      <packaging>xip</packaging>

If you don't use the right parent you might also need to register the xip packaging in your pom:

  <build>
   <extensions>
     <!-- Needed to add support for the "xip" packaging -->
     <extension>
       <groupId>org.xwiki.commons</groupId>
       <artifactId>xwiki-commons-tool-extension-plugin</artifactId>
       <version>${commons.version}</version>
     </extension>
   </extensions>
 </build>

Excluding dependencies

It's possible to indicate a set of dependencies you don't want to include in your XIP (because they are expected to always be there in the target XWiki version) using for example:

  <build>
   <pluginManagement>
     <plugins>
       <plugin>
         <groupId>org.xwiki.commons</groupId>
         <artifactId>xwiki-commons-tool-extension-plugin</artifactId>
         <version>${commons.version}</version>
         <configuration>
           <coreExtensions>
             <!-- We exclude what is already in the XWiki Standard WAR -->
             <coreExtension>
               <groupId>org.xwiki.platform</groupId>
               <artifactId>xwiki-platform-distribution-war-dependencies</artifactId>
               <version>${platform.version}</version>
               <type>pom</type>
             </coreExtension>
           </coreExtensions>
         </configuration>
       </plugin>
     </plugins>
   </pluginManagement>
 </build>

Common parameters

All the Mojos above share a list of parameters. Some of them are described here.

disabledComponents

Since XWiki 12.2.

This parameter allows to specify a list of components to unregister from the component manager.
Example of an usage:

<configuration>
 <disabledComponents>
   <disabledComponent>
     <type>com.xpn.xwiki.doc.MandatoryDocumentInitializer</type>
     <role>XWiki.XWikiServerXwiki</role>
   </disabledComponent>
 </disabledComponents>
</configuration>

Note that if the role is not filled or given, the default hint will be used.

Tags:
   

Get Connected