Skip to content

Get started

This document takes you from nothing to a deployed artifact that another build can resolve. It takes about ten minutes.

Before you begin

You need a CodeSoh account. To create one, see Create an account.

Create a repository

To create a repository, follow these steps:

  1. Go to artifex.soh.gg and sign in.
  2. Click Create repository.
  3. In the Name field, enter a name for people to read, such as Libraries.
  4. In the URL name field, enter the slug that appears in the repository's address, such as libs.
  5. Under Visibility, select Private or Public.
  6. Click Create repository.

The repository page shows its Maven URL:

https://artifex.soh.gg/maven/OWNER/libs/

For every setting, see Repositories.

Create a token

Build tools authenticate with a personal access token, not with your password.

To create one, follow these steps:

  1. Go to accounts.soh.gg and open Personal access tokens.
  2. Click Create token.
  3. In the Name field, enter CI or the name of the machine that uses it.
  4. In the Product list, select Artifex.
  5. In the Expires list, select an expiry.
  6. Click Create token and copy the token. It's shown only once.

For more information, see Personal access tokens.

Grant the token access to the repository

A token reaches nothing until you grant it, even in your own repository.

To grant it, follow these steps:

  1. In Artifex, open the repository and go to Tokens.
  2. In the Token list, select the token that you created.
  3. Under Permission, select Write.
  4. Click Grant access.

For the rules that govern grants, see Tokens in Artifex.

Configure Maven

Put the credentials in ~/.m2/settings.xml:

xml
<settings>
  <servers>
    <server>
      <id>codesoh</id>
      <username>YOUR_HANDLE</username>
      <password>cs_pat_YOUR_TOKEN</password>
    </server>
  </servers>
</settings>

Point your project at the repository in pom.xml:

xml
<distributionManagement>
  <repository>
    <id>codesoh</id>
    <url>https://artifex.soh.gg/maven/OWNER/libs/</url>
  </repository>
  <snapshotRepository>
    <id>codesoh</id>
    <url>https://artifex.soh.gg/maven/OWNER/libs/</url>
  </snapshotRepository>
</distributionManagement>

The id of the server and the id of the repository must match, because that's how Maven finds the credentials.

Configure Gradle

Put the credentials in ~/.gradle/gradle.properties:

properties
codesohUsername=YOUR_HANDLE
codesohPassword=cs_pat_YOUR_TOKEN

Add the repository to build.gradle.kts:

kotlin
plugins {
    `maven-publish`
}

publishing {
    publications {
        create<MavenPublication>("maven") {
            from(components["java"])
        }
    }
    repositories {
        maven {
            name = "codesoh"
            url = uri("https://artifex.soh.gg/maven/OWNER/libs/")
            credentials(PasswordCredentials::class)
        }
    }
}

Gradle reads codesohUsername and codesohPassword because the repository is named codesoh.

Deploy

With Maven:

shell
mvn deploy

With Gradle:

shell
./gradlew publishAllPublicationsToCodesohRepository

Artifex verifies every checksum that the client uploads, records the files, and generates the repository's maven-metadata.xml. For what else happens, see Deploy artifacts.

Resolve

Add the repository to the build that consumes the artifact.

In pom.xml:

xml
<repositories>
  <repository>
    <id>codesoh</id>
    <url>https://artifex.soh.gg/maven/OWNER/libs/</url>
  </repository>
</repositories>

In settings.gradle.kts:

kotlin
dependencyResolutionManagement {
    repositories {
        mavenCentral()
        maven {
            name = "codesoh"
            url = uri("https://artifex.soh.gg/maven/OWNER/libs/")
            credentials(PasswordCredentials::class)
        }
    }
}

A public repository needs no credentials to read. For more information, see Resolve dependencies.

Where to go next