Commit 2a4372ae authored by Suzanne Selhorn's avatar Suzanne Selhorn

Merge branch 'selhorn-maven-update-1' into 'master'

Added duplicate and instance, group, project info

See merge request gitlab-org/gitlab!52029
parents e9a27e4a 78326f28
...@@ -186,10 +186,11 @@ published to the GitLab Package Registry. ...@@ -186,10 +186,11 @@ published to the GitLab Package Registry.
## Authenticate to the Package Registry with Maven ## Authenticate to the Package Registry with Maven
To authenticate to the Package Registry, you need either a personal access token or deploy token. To authenticate to the Package Registry, you need one of the following:
- If you use a [personal access token](../../../user/profile/personal_access_tokens.md), set the scope to `api`. - A [personal access token](../../../user/profile/personal_access_tokens.md) with the scope set to `api`.
- If you use a [deploy token](../../project/deploy_tokens/index.md), set the scope to `read_package_registry`, `write_package_registry`, or both. - A [deploy token](../../project/deploy_tokens/index.md) with the scope set to `read_package_registry`, `write_package_registry`, or both.
- A [CI_JOB_TOKEN](#authenticate-with-a-ci-job-token-in-maven).
### Authenticate with a personal access token in Maven ### Authenticate with a personal access token in Maven
...@@ -354,12 +355,13 @@ repositories { ...@@ -354,12 +355,13 @@ repositories {
To use the GitLab endpoint for Maven packages, choose an option: To use the GitLab endpoint for Maven packages, choose an option:
- **Project-level**: Use when you have few Maven packages and they are not in - **Project-level**: To publish Maven packages to a project, use a project-level endpoint.
the same GitLab group. To install Maven packages, use a project-level endpoint when you have few Maven packages
- **Group-level**: Use when you have many Maven packages in the same GitLab and they are not in the same GitLab group.
group. - **Group-level**: Use a group-level endpoint when you want to install packages from
- **Instance-level**: Use when you have many Maven packages in different many different projects in the same GitLab group.
GitLab groups or in their own namespace. - **Instance-level**: Use an instance-level endpoint when you want to install many
packages from different GitLab groups or in their own namespace.
The option you choose determines the settings you add to your `pom.xml` file. The option you choose determines the settings you add to your `pom.xml` file.
...@@ -533,7 +535,7 @@ repositories { ...@@ -533,7 +535,7 @@ repositories {
After you have set up the [remote and authentication](#authenticate-to-the-package-registry-with-maven) After you have set up the [remote and authentication](#authenticate-to-the-package-registry-with-maven)
and [configured your project](#use-the-gitlab-endpoint-for-maven-packages), and [configured your project](#use-the-gitlab-endpoint-for-maven-packages),
publish a Maven artifact from your project. publish a Maven package to your project.
### Publish by using Maven ### Publish by using Maven
...@@ -604,11 +606,20 @@ To publish a package by using Gradle: ...@@ -604,11 +606,20 @@ To publish a package by using Gradle:
Now navigate to your project's **Packages & Registries** page and view the published artifacts. Now navigate to your project's **Packages & Registries** page and view the published artifacts.
### Publishing a package with the same name or version
When you publish a package with the same name or version as an existing package,
the existing package is overwritten.
## Install a package ## Install a package
To install a package from the GitLab Package Registry, you must configure To install a package from the GitLab Package Registry, you must configure
the [remote and authenticate](#authenticate-to-the-package-registry-with-maven). the [remote and authenticate](#authenticate-to-the-package-registry-with-maven).
When this is completed, there are two ways to install a package. When this is completed, you can install a package from a project,
group, or namespace.
If multiple packages have the same name and version, when you install
a package, the most recently-published package is retrieved.
### Use Maven with `mvn install` ### Use Maven with `mvn install`
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment