commit a0b0d7bf996153c481dbdb49b1d3e49a7f99ebe0 Author: Meghdad Fadaee Date: Mon Mar 9 19:20:56 2026 +0000 add README diff --git a/README.md b/README.md new file mode 100644 index 0000000..7aace0a --- /dev/null +++ b/README.md @@ -0,0 +1,152 @@ +# Kotlin / Gradle Mirror Setup with Nexus (Air‑Gapped Environment) + +This document summarizes the steps performed to configure a +Kotlin/Gradle package mirror using Sonatype Nexus Repository in an +offline (air‑gapped) 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**. + +------------------------------------------------------------------------ + +# 2. 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 + +5. Click **Save**. + +This repository will host Kotlin and Gradle artifacts for the offline +environment. + +------------------------------------------------------------------------ + +# 3. 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 + +------------------------------------------------------------------------ + +# 4. 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 + +3. Upload the following files: + +- kotlin-stdlib-1.9.0.jar +- kotlin-stdlib-1.9.0.pom + +4. Click **Upload**. + +The artifact will now be stored inside the repository. + +------------------------------------------------------------------------ + +# 5. 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. + +------------------------------------------------------------------------ + +# 6. Configure Gradle to Use the Mirror + +Modify your Gradle project configuration to use the Nexus mirror instead +of Maven Central. + +Example `build.gradle` configuration: + +``` groovy +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. + +------------------------------------------------------------------------ + +# 7. Prepare for Offline Dependency Usage + +Ensure that all required dependencies are uploaded to Nexus beforehand.\ +For Kotlin projects this may include additional dependencies such as: + +- kotlin-stdlib-common +- org.jetbrains.annotations + +These must also be downloaded externally and uploaded to the mirror. + +------------------------------------------------------------------------ + +# 8. Test Build in Offline Environment + +Run the Gradle build on the offline server: + +``` bash +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 air‑gapped environment. + +------------------------------------------------------------------------ + +End of document.