Wiki source code of Fill a Local Maven Repository for an Offline Instance
Last modified by Eleni Cojocariu on 2026/10/28 16:11
Show last authors
| author | version | line-number | content |
|---|---|---|---|
| 1 | Populate a Maven repository that an XWiki server with no internet access can install its [[extensions>>doc:documentation.xs.user.extensions.WebHome]] from. | ||
| 2 | |||
| 3 | Before starting: | ||
| 4 | |||
| 5 | * A staging server with internet access, to collect the resources from. | ||
| 6 | * [[Maven>>https://maven.apache.org/]] on the staging server, as for [[building XWiki from source>>dev:Community.Building]]. | ||
| 7 | * A way to copy the resources from the staging server to the production server. | ||
| 8 | * Write access to ##xwiki.properties## on the production server. | ||
| 9 | |||
| 10 | 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:((( | ||
| 11 | {{code language="xml"}} | ||
| 12 | <project xmlns="http://maven.apache.org/POM/4.0.0" | ||
| 13 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| 14 | xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
| 15 | <modelVersion>4.0.0</modelVersion> | ||
| 16 | |||
| 17 | <groupId>org.example</groupId> | ||
| 18 | <artifactId>xwiki-offline-download</artifactId> | ||
| 19 | <version>1.0</version> | ||
| 20 | <packaging>pom</packaging> | ||
| 21 | |||
| 22 | <repositories> | ||
| 23 | <repository> | ||
| 24 | <id>xwiki-public</id> | ||
| 25 | <url>https://nexus.xwiki.org/nexus/content/groups/public</url> | ||
| 26 | </repository> | ||
| 27 | </repositories> | ||
| 28 | |||
| 29 | <dependencies> | ||
| 30 | <dependency> | ||
| 31 | <groupId>org.xwiki.contrib</groupId> | ||
| 32 | <artifactId>xwiki-application-admintools</artifactId> | ||
| 33 | <version>4.5.7</version> | ||
| 34 | <type>xar</type> | ||
| 35 | </dependency> | ||
| 36 | <dependency> | ||
| 37 | <groupId>org.xwiki.platform</groupId> | ||
| 38 | <artifactId>xwiki-platform-distribution-flavor-mainwiki</artifactId> | ||
| 39 | <version>17.10.4</version> | ||
| 40 | <type>xar</type> | ||
| 41 | </dependency> | ||
| 42 | <!-- Add the other extensions here. --> | ||
| 43 | </dependencies> | ||
| 44 | </project> | ||
| 45 | {{/code}} | ||
| 46 | ))) | ||
| 47 | 1. 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. | ||
| 48 | 1. Open a command line in that directory, and resolve every dependency into a separate empty directory, which becomes the offline repository:((( | ||
| 49 | {{code language="bash"}} | ||
| 50 | mvn -Dmaven.repo.local=/path/to/offline-repository dependency:go-offline | ||
| 51 | {{/code}} | ||
| 52 | ))) | ||
| 53 | 1. Copy that directory to the production server, somewhere the user running XWiki can read. | ||
| 54 | 1. Declare it in ##xwiki.properties## as the instance's only extension repository:((( | ||
| 55 | {{code language="properties"}} | ||
| 56 | extension.repositories=offline-maven:maven:file:///path/on/the/server/offline-repository | ||
| 57 | {{/code}} | ||
| 58 | ))) | ||
| 59 | 1. Restart XWiki, go to "Administration", then "Extensions", and click "More" followed by "Advanced search". Enter the extension id as ##groupId:artifactId##, and its version:((( | ||
| 60 | {{image reference="extension-manager-advanced-search.png" size="large" alt="The Advanced search form of the Extension Manager, with an extension id and a version filled in"/}} | ||
| 61 | ))) | ||
| 62 | 1. Click "Search". The extension is found in your local repository and is ready to install:((( | ||
| 63 | {{image reference="extension-found-advanced-search.png" size="large" alt="The Admin Tools Application found by the Advanced search, with its Install button"/}} | ||
| 64 | ))) |