Fill a Local Maven Repository for an Offline Instance

Last modified by Eleni Cojocariu on 2026/10/28 16:11

Steps

Populate a Maven repository that an XWiki server with no internet access can install its extensions from.

Before starting:

  • A staging server with internet access, to collect the resources from.
  • Maven on the staging server, as for building XWiki from source.
  • A way to copy the resources from the staging server to the production server.
  • Write access to xwiki.properties on the production server.
  1. Create an empty directory on the staging server and save this pom.xml in it, with one <dependency> per extension to take offline. Include the standard flavor, the second dependency below, only when you are upgrading the user interface of a wiki that is already installed:
    <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>
    
      <groupId>org.example</groupId>
      <artifactId>xwiki-offline-download</artifactId>
      <version>1.0</version>
      <packaging>pom</packaging>
    
      <repositories>
        <repository>
          <id>xwiki-public</id>
          <url>https://nexus.xwiki.org/nexus/content/groups/public</url>
        </repository>
      </repositories>
    
      <dependencies>
        <dependency>
          <groupId>org.xwiki.contrib</groupId>
          <artifactId>xwiki-application-admintools</artifactId>
          <version>4.5.7</version>
          <type>xar</type>
        </dependency>
        <dependency>
          <groupId>org.xwiki.platform</groupId>
          <artifactId>xwiki-platform-distribution-flavor-mainwiki</artifactId>
          <version>17.10.4</version>
          <type>xar</type>
        </dependency>
        <!-- Add the other extensions here. -->
      </dependencies>
    </project>
  2. Set each <version> to the version you want to install. For an extension bundled with XWiki, use the version of the instance it is going to be installed on.
  3. Open a command line in that directory, and resolve every dependency into a separate empty directory, which becomes the offline repository:
    mvn -Dmaven.repo.local=/path/to/offline-repository dependency:go-offline
  4. Copy that directory to the production server, somewhere the user running XWiki can read.
  5. Declare it in xwiki.properties as the instance's only extension repository:
    extension.repositories=offline-maven:maven:file:///path/on/the/server/offline-repository
  6. Restart XWiki, go to "Administration", then "Extensions", and click "More" followed by "Advanced search". Enter the extension id as groupId:artifactId, and its version:

    The Advanced search form of the Extension Manager, with an extension id and a version filled in

  7. Click "Search". The extension is found in your local repository and is ready to install:

    The Admin Tools Application found by the Advanced search, with its Install button

FAQ

When should I use this instead of the XIP package?

Use this method only when the server has no network access and no other way of installing the extensions is available. It installs extensions through the wiki's Extension Manager, so the wiki must already be running, and the Distribution Wizard cannot discover flavors in the repository: to set up the user interface of a brand-new wiki offline, use the XIP package instead.

Why must I type the extension id instead of searching by name?

A filesystem Maven repository offers no search, so the Extension Manager cannot list what it holds and can only look an extension up by its exact id.

How much data does this transfer?

That depends on what you list: the standard flavor pulls about 300 MB on its own. List every extension you need in the same pom.xml before copying, so you transfer the directory once.

Do the default repositories still work?

No. Setting extension.repositories replaces the defaults that point at xwiki.org, which is what you want on a server that cannot reach them.

Related

Get Connected