Upgrading to 3.71.0+ for Instances Using H2, a Pre-3.69.0 Nexus Repository Version, and Java 8 or 11
Nexus Repository versions 3.70.0 and above require that your H2 database be on version 2.x; earlier Nexus Repository versions used H2 version 1.x. In release 3.69.0, we added a task to help you upgrade your H2 database. Therefore, you will need to upgrade to 3.69.0 before you can continue beyond that version.
Nexus Repository version 3.71.0 and above also require Java 17, so you will need to upgrade your Java version before you can upgrade to 3.71.0.
The sections below will walk you through the process.
Phase 1 - Upgrade to 3.69.x and Export Database
Upgrading your H2 database involves generating an export of that database; should any changes continue to be made in your Nexus Repository instance after generating this export, those changes will be lost and not included in the exported file. To minimize any potential for lost information during the upgrade period, complete the following prerequisite steps immediately before upgrading to Sonatype Nexus Repository 3.70.0+:
Upgrade to Sonatype Nexus Repository version 3.69.0.
In version 3.69.0, create and run the Admin - Export SQL database to script task.
Check the
$data-dir/db
folder for the file that the task created; it will have a name like "nexus-<timestamp>.sql
."
You can now continue to upgrade to 3.71.0 while also upgrading to Java 17.
Phase 2 - Upgrade Your H2 Database, Java Version, and Nexus Repository Instance
Since Nexus Repository 3.71.0+ requires Java 17, you will need to change your Java version while upgrading your Nexus Repository instance. If you are unsure how to do this, refer to our documentation on how to change your Java version. Otherwise, your upgrade follows normal upgrade procedures with the following additional steps to upgrade your H2 database:
Before starting your upgraded Nexus Repository instance, ensure the
$data-dir/db
folder contains the previously builtnexus-<timestamp>.sql
file and the H2 database file called "nexus.mv.db
." Do not remove or rename thenexus.mv.db
file.Start your Sonatype Nexus Repository instance.
Sonatype Nexus Repository will now perform the H2 upgrade.
As part of the upgrade process, Nexus Repository will create a backup of the H2 v1.4.200 database in the
$data-dir/db
folder should you need it for rollback purposes. This file will be callednexus-<timestamp>-backup.zip
.Note that if multiple
nexus-<timestamp>.sql
files exist in the$data-dir/db
folder, Nexus Repository will use the file with the most recent timestamp to create the H2 v2.2.224 database.
Verify that Nexus Repository started correctly with all expected repository information.
You can now delete the SQL and backup files.