Maven Packages Repository

Publish Maven packages for your user or organization.

Requirements

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

Configuring the package registry

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

  1. <settings>
  2. <servers>
  3. <server>
  4. <id>gitea</id>
  5. <configuration>
  6. <httpHeaders>
  7. <property>
  8. <name>Authorization</name>
  9. <value>token {access_token}</value>
  10. </property>
  11. </httpHeaders>
  12. </configuration>
  13. </server>
  14. </servers>
  15. </settings>

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

  1. <repositories>
  2. <repository>
  3. <id>gitea</id>
  4. <url>https://gitea.example.com/api/packages/{owner}/maven</url>
  5. </repository>
  6. </repositories>
  7. <distributionManagement>
  8. <repository>
  9. <id>gitea</id>
  10. <url>https://gitea.example.com/api/packages/{owner}/maven</url>
  11. </repository>
  12. <snapshotRepository>
  13. <id>gitea</id>
  14. <url>https://gitea.example.com/api/packages/{owner}/maven</url>
  15. </snapshotRepository>
  16. </distributionManagement>
ParameterDescription
access_tokenYour personal access token.
ownerThe owner of the package.

Publish a package

To publish a package simply run:

  1. mvn deploy

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

  1. mvn deploy:deploy-file -Durl=https://gitea.example.com/api/packages/{owner}/maven -DrepositoryId=gitea -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.

Install a package

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

  1. <dependency>
  2. <groupId>com.test.package</groupId>
  3. <artifactId>test_project</artifactId>
  4. <version>1.0.0</version>
  5. </dependency>

Afterwards run:

  1. mvn install

Supported commands

  1. mvn install
  2. mvn deploy
  3. mvn dependency:get: