Skip to content

Maven Package Registry

Publish Maven packages for your user or organization.

To work with the Maven package registry, you can use Maven or Gradle. The following examples use Maven and Gradle Groovy.

To register the package registry you first need to add your access token to the settings.xml file:

<settings>
<servers>
<server>
<id>hoyoship</id>
<username>{owner}</username>
<password>{access_token}</password>
</server>
</servers>
</settings>

Afterwards add the following sections to your project pom.xml file:

<repositories>
<repository>
<id>hoyoship</id>
<url>https://hoyoship.example.com/api/packages/{owner}/maven</url>
</repository>
</repositories>
<distributionManagement>
<repository>
<id>hoyoship</id>
<url>https://hoyoship.example.com/api/packages/{owner}/maven</url>
</repository>
<snapshotRepository>
<id>hoyoship</id>
<url>https://hoyoship.example.com/api/packages/{owner}/maven</url>
</snapshotRepository>
</distributionManagement>
ParameterDescription
access_tokenYour personal access token.
ownerThe owner of the package.

When you plan to add some packages from HoyoShip instance in your project, you should add it in repositories section:

repositories {
// other repositories
maven { url "https://hoyoship.example.com/api/packages/{owner}/maven" }
}

In Groovy gradle you may include next script in your publishing part:

publishing {
// other settings of publication
repositories {
maven {
name = "HoyoShip"
url = uri("https://hoyoship.example.com/api/packages/{owner}/maven")
credentials(HttpHeaderCredentials) {
name = "Authorization"
value = "token {access_token}"
}
authentication {
header(HttpHeaderAuthentication)
}
}
}
}

To publish a package simply run:

Terminal window
mvn deploy

Or call gradle with task publishAllPublicationsToHoyoShipRepository in case you are using gradle:

./gradlew publishAllPublicationsToHoyoShipRepository

If you want to publish a prebuild package to the registry, you can use mvn deploy:deploy-file:

Terminal window
mvn deploy:deploy-file -Durl=https://hoyoship.example.com/api/packages/{owner}/maven -DrepositoryId=hoyoship -Dfile=/path/to/package.jar
ParameterDescription
ownerThe owner of the package.

You cannot publish a package if a package of the same name and version already exists. You must delete the existing package first.

To install a Maven package from the package registry, add a new dependency to your project pom.xml file:

<dependency>
<groupId>com.test.package</groupId>
<artifactId>test_project</artifactId>
<version>1.0.0</version>
</dependency>

And analog in gradle groovy:

implementation "com.test.package:test_project:1.0.0"

Afterwards run:

Terminal window
mvn install
mvn install
mvn deploy
mvn dependency:get: