Skip to content
GitHub

Configure Java

Point Maven or Gradle dependencies at Depsilo's /maven/ route with a mirror or repository entry.

BEFOREhttps://repo.maven.apache.org/maven2
AFTERhttp://localhost:23333/maven/

Maven and Gradle share the /maven/ route. Maven has no general command-line option that overrides every remote repository, so configure a mirror.

~/.m2/settings.xml
<settings>
<mirrors>
<mirror>
<id>depsilo</id>
<url>http://localhost:23333/maven/</url>
<mirrorOf>*</mirrorOf>
</mirror>
</mirrors>
</settings>
终端窗口
mvn help:effective-settings | grep depsilo

<mirrorOf>*</mirrorOf> routes every declared repository through Depsilo. If you need exclusions, express them explicitly instead of relying on an implicit public fallback.

Use ~/.gradle/init.gradle for a machine-wide setting:

~/.gradle/init.gradle
allprojects {
repositories {
maven { url "http://localhost:23333/maven/" }
}
}

Or add the repository to the project’s repositories block. Choose one of the two, not both.

  1. Check that the instance is ready

    终端窗口
    curl -fsS http://localhost:23333/ready
  2. Refresh dependencies

    终端窗口
    gradle dependencies --refresh-dependencies
  3. Confirm the traffic in Admin

    Check the /maven/ requests and cache results in Access logs.