mc-mirror is a simple HTTP proxy for mirroring Maven Central with local artifact caching. It intercepts GET and HEAD requests from Maven clients, caches the downloaded files, and serves them directly on subsequent requests.
- β
Supports
GETandHEADrequests - π Local artifact caching in the
./storagedirectory - π Easy port configuration via
-portflag - β‘ Works as a "lazy" mirror β downloads files on demand
- π³ Planned: Docker Compose support for easier deployment
git clone https://github.com/jf17/mc-mirror.git
cd mc-mirror
go run mc-mirror.go -port=8080| Parameter | Description | Default Value |
|---|---|---|
-port |
Port on which the server runs | 8080 |
To use mc-mirror as a mirror, add the following block to your ~/.m2/settings.xml file:
<settings>
<mirrors>
<mirror>
<id>mc-mirror</id>
<url>http://localhost:8080</url>
<mirrorOf>*</mirrorOf>
</mirror>
</mirrors>
</settings>To use mc-mirror with Gradle, modify your repositories block in build.gradle (Groovy DSL):
repositories {
maven {
url "http://localhost:8080"
}
}Or in build.gradle.kts (Kotlin DSL):
repositories {
maven {
url = uri("http://localhost:8080")
}
}π‘ Note: If you're also using other repositories, make sure to list them after
mc-mirror, since Gradle checks repositories in order.
Once the server is running and your build tool is configured, you can run commands like:
mvn dependency:resolveor for Gradle:
./gradlew buildThe first time, dependencies will be fetched from Maven Central and cached. On subsequent requests, they will be served from the local ./storage directory.