aboutsummaryrefslogtreecommitdiffstats
path: root/docs/content/usage/packages/maven.en-us.md
diff options
context:
space:
mode:
authorJohn Olheiser <john.olheiser@gmail.com>2023-07-25 23:53:13 -0500
committerGitHub <noreply@github.com>2023-07-26 04:53:13 +0000
commitbd4c7ce578956d9839309b16753bd5505b63b2e3 (patch)
tree1d3074ef542cee11707bc4985ce54dc40facb9b6 /docs/content/usage/packages/maven.en-us.md
parent5dc37ef97a30628027a723ee944225a33a6511f8 (diff)
downloadgitea-bd4c7ce578956d9839309b16753bd5505b63b2e3.tar.gz
gitea-bd4c7ce578956d9839309b16753bd5505b63b2e3.zip
Docusaurus-ify (#26051)
This PR cleans up the docs in a way to make them simpler to ingest by our [docs repo](https://gitea.com/gitea/gitea-docusaurus). 1. It includes all of the sed invocations our ingestion did, removing the need to do it at build time. 2. It replaces the shortcode variable replacement method with `@variable@` style, simply for easier sed invocations when required. 3. It removes unused files and moves the docs up a level as cleanup. --------- Signed-off-by: jolheiser <john.olheiser@gmail.com>
Diffstat (limited to 'docs/content/usage/packages/maven.en-us.md')
-rw-r--r--docs/content/usage/packages/maven.en-us.md163
1 files changed, 163 insertions, 0 deletions
diff --git a/docs/content/usage/packages/maven.en-us.md b/docs/content/usage/packages/maven.en-us.md
new file mode 100644
index 0000000000..59e71c87cc
--- /dev/null
+++ b/docs/content/usage/packages/maven.en-us.md
@@ -0,0 +1,163 @@
+---
+date: "2021-07-20T00:00:00+00:00"
+title: "Maven Package Registry"
+slug: "maven"
+sidebar_position: 60
+draft: false
+toc: false
+menu:
+ sidebar:
+ parent: "packages"
+ name: "Maven"
+ sidebar_position: 60
+ identifier: "maven"
+---
+
+# Maven Package Registry
+
+Publish [Maven](https://maven.apache.org) packages for your user or organization.
+
+## Requirements
+
+To work with the Maven package registry, you can use [Maven](https://maven.apache.org/install.html) or [Gradle](https://gradle.org/install/).
+The following examples use `Maven` and `Gradle Groovy`.
+
+## Configuring the package registry
+
+To register the package registry you first need to add your access token to the [`settings.xml`](https://maven.apache.org/settings.html) file:
+
+```xml
+<settings>
+ <servers>
+ <server>
+ <id>gitea</id>
+ <configuration>
+ <httpHeaders>
+ <property>
+ <name>Authorization</name>
+ <value>token {access_token}</value>
+ </property>
+ </httpHeaders>
+ </configuration>
+ </server>
+ </servers>
+</settings>
+```
+
+Afterwards add the following sections to your project `pom.xml` file:
+
+```xml
+<repositories>
+ <repository>
+ <id>gitea</id>
+ <url>https://gitea.example.com/api/packages/{owner}/maven</url>
+ </repository>
+</repositories>
+<distributionManagement>
+ <repository>
+ <id>gitea</id>
+ <url>https://gitea.example.com/api/packages/{owner}/maven</url>
+ </repository>
+ <snapshotRepository>
+ <id>gitea</id>
+ <url>https://gitea.example.com/api/packages/{owner}/maven</url>
+ </snapshotRepository>
+</distributionManagement>
+```
+
+| Parameter | Description |
+| -------------- | ----------- |
+| `access_token` | Your [personal access token](development/api-usage.md#authentication). |
+| `owner` | The owner of the package. |
+
+### Gradle variant
+
+When you plan to add some packages from Gitea instance in your project, you should add it in repositories section:
+
+```groovy
+repositories {
+ // other repositories
+ maven { url "https://gitea.example.com/api/packages/{owner}/maven" }
+}
+```
+
+In Groovy gradle you may include next script in your publishing part:
+
+```groovy
+publishing {
+ // other settings of publication
+ repositories {
+ maven {
+ name = "Gitea"
+ url = uri("https://gitea.example.com/api/packages/{owner}/maven")
+
+ credentials(HttpHeaderCredentials) {
+ name = "Authorization"
+ value = "token {access_token}"
+ }
+
+ authentication {
+ header(HttpHeaderAuthentication)
+ }
+ }
+ }
+}
+```
+
+## Publish a package
+
+To publish a package simply run:
+
+```shell
+mvn deploy
+```
+
+Or call `gradle` with task `publishAllPublicationsToGiteaRepository` in case you are using gradle:
+
+```groovy
+./gradlew publishAllPublicationsToGiteaRepository
+```
+
+If you want to publish a prebuild package to the registry, you can use [`mvn deploy:deploy-file`](https://maven.apache.org/plugins/maven-deploy-plugin/deploy-file-mojo.html):
+
+```shell
+mvn deploy:deploy-file -Durl=https://gitea.example.com/api/packages/{owner}/maven -DrepositoryId=gitea -Dfile=/path/to/package.jar
+```
+
+| Parameter | Description |
+| -------------- | ----------- |
+| `owner` | The 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:
+
+```xml
+<dependency>
+ <groupId>com.test.package</groupId>
+ <artifactId>test_project</artifactId>
+ <version>1.0.0</version>
+</dependency>
+```
+
+And analog in gradle groovy:
+
+```groovy
+implementation "com.test.package:test_project:1.0.0"
+```
+
+Afterwards run:
+
+```shell
+mvn install
+```
+
+## Supported commands
+
+```
+mvn install
+mvn deploy
+mvn dependency:get:
+```