The starter set includes the maven-central proxy repository (a Maven Central mirror) and the maven-releases (releases) and maven-snapshots (snapshot versions) hosted repositories.

Connecting to the proxy

Point Maven at the mirror in ~/.m2/settings.xml:

<settings>
  <mirrors>
    <mirror>
      <id>galleon-central</id>
      <url>https://<GALLEON_HOST>/repository/maven-central</url>
      <mirrorOf>central</mirrorOf>
    </mirror>
  </mirrors>
</settings>

If anonymous access to the repository is disabled, add a <server> block with the same id as the mirror and your credentials — following the example in the Publishing section.

Publishing

Specify the target repository in pom.xml and the credentials in settings.xml — the id values in both blocks must match:

<!-- pom.xml -->
<distributionManagement>
  <repository>
    <id>galleon-releases</id>
    <url>https://<GALLEON_HOST>/repository/maven-releases</url>
  </repository>
</distributionManagement>
<!-- ~/.m2/settings.xml -->
<settings>
  <servers>
    <server>
      <id>galleon-releases</id>
      <username><USERNAME></username>
      <password><PASSWORD></password>
    </server>
  </servers>
</settings>
mvn deploy

Publishing from Gradle:

publishing {
  repositories {
    maven {
      url = uri("https://<GALLEON_HOST>/repository/maven-releases")
      credentials {
        username = "<USERNAME>"
        password = "<PASSWORD>"
      }
    }
  }
}

Consuming published artifacts

The mirror covers Maven Central only, so hosted repositories are added to the build with separate entries — in pom.xml or in a settings.xml profile:

<repositories>
  <repository>
    <id>galleon-releases</id>
    <url>https://<GALLEON_HOST>/repository/maven-releases</url>
  </repository>
  <repository>
    <id>galleon-snapshots</id>
    <url>https://<GALLEON_HOST>/repository/maven-snapshots</url>
    <snapshots>
      <enabled>true</enabled>
    </snapshots>
  </repository>
</repositories>

For Gradle:

repositories {
  maven { url = uri("https://<GALLEON_HOST>/repository/maven-releases") }
  maven { url = uri("https://<GALLEON_HOST>/repository/maven-snapshots") }
}

The credentials are the same <server> (Maven) or credentials (Gradle) blocks as for publishing.

Releases and snapshot versions

Re-publishing an existing release version is rejected with 409: releases are immutable.

Every upload of a snapshot version gets a timestamp (YYYYMMDD.HHMMSS-N) and lands in maven-metadata.xml; requesting the X-SNAPSHOT version returns the latest build.

Specifics

Format specifics:

  • maven-metadata.xml is generated by the server automatically — do not publish it.
  • A hosted repository serves only the checksum files uploaded by the client: Maven publishes .sha1 and .md5 by default. To publish all four, deploy with -Daether.checksums.algorithms=SHA-1,MD5,SHA-256,SHA-512.
  • Classifiers (sources, javadoc) work as usual.