Install
Package types

Maven and Gradle

Resolve and deploy Java artifacts with Maven and Gradle; virtual repositories merge metadata.

This command writes ~/.m2/settings.xml: a mirror through the repository, with credentials:

relic package setup maven maven --write

To deploy, add distributionManagement to pom.xml, with the repository's name as server id:

<distributionManagement>
  <repository><id>maven</id><url>https://relic.example.com/maven/maven</url></repository>
  <snapshotRepository><id>maven</id><url>https://relic.example.com/maven/maven</url></snapshotRepository>
</distributionManagement>

Deploy:

mvn deploy

This command writes relicUrl, relicUser and relicToken to ~/.gradle/gradle.properties:

relic package setup gradle maven --write

By hand, add a mirror to settings.xml, and a <server> of the same id with credentials:

<mirror><id>relic</id><mirrorOf>*</mirrorOf><url>https://relic.example.com/maven/maven</url></mirror>

For Gradle by hand, add an init script to ~/.gradle/init.d/:

def relic = { MavenArtifactRepository repo ->
    repo.url = uri("https://relic.example.com/maven/maven")
    repo.credentials { username = "<you>"; password = "<token>" }
}
settingsEvaluated { it.pluginManagement.repositories { maven { relic(it) } } }
allprojects { repositories { maven { relic(it) } } }
  • For a private CA (TLS), add the CA certificate to the JVM's trust store.
  • Relic generates maven-metadata.xml; a snapshot's metadata points at its newest upload. Virtual repositories merge their members' metadata.
  • A POM or JAR has a Dependency tab (Maven, Gradle, Ivy, SBT) and an Archive tab.