Skip to content

Maven publishing and dependency resolution ​

In the Console under Repositories, choose maven. Create separate Hosted repositories maven-releases and maven-snapshots. Point the maven-central Proxy at https://repo.maven.apache.org/maven2/. Add both Hosted repositories and the Proxy to maven-public in priority order. Member order and permissions determine which artifact is returned when coordinates overlap.

Replace https://packages.example.org throughout with the external address of your instance. Configure credentials and the Group in ~/.m2/settings.xml. Inject the API token as ARKA_TOKEN and username as ARKA_USER. Publishers need write on their Hosted target. Consumers need read on Group and relevant members.

xml
<settings>
  <servers>
    <server><id>arka-read</id><username>${env.ARKA_USER}</username><password>${env.ARKA_TOKEN}</password></server>
    <server><id>arka-release</id><username>${env.ARKA_USER}</username><password>${env.ARKA_TOKEN}</password></server>
    <server><id>arka-snapshot</id><username>${env.ARKA_USER}</username><password>${env.ARKA_TOKEN}</password></server>
  </servers>
  <mirrors>
    <mirror><id>arka-read</id><mirrorOf>central</mirrorOf>
      <url>https://packages.example.org/repository/maven-public/</url></mirror>
  </mirrors>
  <profiles>
    <profile><id>arka</id><repositories><repository>
      <id>arka-read</id><url>https://packages.example.org/repository/maven-public/</url>
      <releases><enabled>true</enabled></releases><snapshots><enabled>true</enabled></snapshots>
    </repository></repositories></profile>
  </profiles>
  <activeProfiles><activeProfile>arka</activeProfile></activeProfiles>
</settings>

Add the following inside <project> in your project’s pom.xml.

xml
<distributionManagement>
  <repository><id>arka-release</id><url>https://packages.example.org/repository/maven-releases/</url></repository>
  <snapshotRepository><id>arka-snapshot</id><url>https://packages.example.org/repository/maven-snapshots/</url></snapshotRepository>
</distributionManagement>

Run mvn -B deploy from a release project such as 1.0.0 and a snapshot project such as 1.0.1-SNAPSHOT. Maven picks the target from the POM version and writes timestamped files and maven-metadata.xml to the snapshot repository. Verify from a consumer project.

bash
mvn -U dependency:get -Dartifact=org.example:demo:1.0.0
mvn -U dependency:get -Dartifact=org.example:demo:1.0.1-SNAPSHOT

On a 401, check that the server ID matches the publishing repository or mirror ID. If a snapshot cannot be resolved, check that Group includes the snapshots Hosted, the reader has access, and the client allows snapshots. To force downloads from Arka, use -Dmaven.repo.local=/path/to/temp-directory. On upload checksum errors, compare the artifact with its .sha1, .md5, or .sha256 sidecar.

Released under the Apache 2.0 License.