2026-03-09 22:55:58 +03:30
2026-03-09 22:55:58 +03:30

Kotlin / Gradle Mirror Setup with Nexus (AirGapped Environment)

This document summarizes the steps performed to configure a Kotlin/Gradle package mirror using Sonatype Nexus Repository in an offline (airgapped) Ubuntu server environment. The server already has Docker installed and Nexus is accessible via:

https://mirror.mahgit.ir/

The steps below cover the process from creating the repository to testing Gradle builds in the offline environment.


1. Create the Repository

  1. Log in to the Nexus UI:

    https://mirror.mahgit.ir/

  2. Navigate to:

    Administration → Repositories → Create repository

  3. Select:

    maven2 (hosted)

  4. Configure the repository:

Setting Value
Name kotlin-mirror
Version policy Release
Layout policy Strict
Deployment policy Allow redeploy
  1. Click Save.

This repository will host Kotlin and Gradle artifacts for the offline environment.


2. Repository URL

After creation, the repository is accessible at:

https://mirror.mahgit.ir/repository/kotlin-mirror/

Example artifact URL:

https://mirror.mahgit.ir/repository/kotlin-mirror/org/jetbrains/kotlin/kotlin-stdlib/1.9.0/kotlin-stdlib-1.9.0.jar


3. Upload the Artifact

Because the server has no internet access, artifacts must be downloaded externally and uploaded manually.

Steps:

  1. In Nexus UI navigate to:

    Browse → kotlin-mirror → Upload

  2. Fill the fields:

Field Value
Group org.jetbrains.kotlin
Artifact kotlin-stdlib
Version 1.9.0
Packaging jar
  1. Upload the following files:
  • kotlin-stdlib-1.9.0.jar
  • kotlin-stdlib-1.9.0.pom
  1. Click Upload.

The artifact will now be stored inside the repository.


4. Test Artifact Download

Open the artifact URL in a browser:

https://mirror.mahgit.ir/repository/kotlin-mirror/org/jetbrains/kotlin/kotlin-stdlib/1.9.0/kotlin-stdlib-1.9.0.jar

If the file downloads successfully, the repository is working correctly.


5. Configure Gradle to Use the Mirror

Modify your Gradle project configuration to use the Nexus mirror instead of Maven Central.

Example build.gradle configuration:

repositories {
    maven {
        url "https://mirror.mahgit.ir/repository/kotlin-mirror/"
    }
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib:1.9.0"
}

Gradle will now resolve dependencies from the Nexus mirror.


6. Test Build in Offline Environment

Run the Gradle build on the offline server:

gradle build

Expected behavior:

Gradle resolves dependencies only from the Nexus mirror:

Gradle → Nexus Mirror → Local Artifact Storage

If the build completes successfully, the mirror setup is functioning correctly in the airgapped environment.


End of document.

Description
No description provided
Readme 26 KiB