Maven API
- Tier: Free, Premium, Ultimate
- Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated
Use this API to interact with the Maven package manager client.
This API is used by the Maven package manager client and is generally not meant for manual consumption.
These endpoints do not adhere to the standard API authentication methods. See Maven package registry documentation for details on which headers and token types are supported. Undocumented authentication methods might be removed in the future.
Download a package file for an instance
Downloads a specified Maven package file for the instance.
GET packages/maven/*path/:file_name| Attribute | Type | Required | Description |
|---|---|---|---|
path | string | yes | The Maven package path, in the format <groupId>/<artifactId>/<version>. Replace any . in the groupId with /. |
file_name | string | yes | The name of the Maven package file. |
curl --header "PRIVATE-TOKEN: <personal_access_token>" \
--url "https://gitlab.example.com/api/v4/packages/maven/foo/bar/mypkg/1.0-SNAPSHOT/mypkg-1.0-SNAPSHOT.jar"To write the output to file:
curl --header "PRIVATE-TOKEN: <personal_access_token>" \
--url "https://gitlab.example.com/api/v4/packages/maven/foo/bar/mypkg/1.0-SNAPSHOT/mypkg-1.0-SNAPSHOT.jar" >> mypkg-1.0-SNAPSHOT.jarThis writes the downloaded file to mypkg-1.0-SNAPSHOT.jar in the current directory.
Download a package file for a group-level
Downloads a specified Maven package file for a group.
GET groups/:id/-/packages/maven/*path/:file_name| Attribute | Type | Required | Description |
|---|---|---|---|
path | string | yes | The Maven package path, in the format <groupId>/<artifactId>/<version>. Replace any . in the groupId with /. |
file_name | string | yes | The name of the Maven package file. |
curl --header "PRIVATE-TOKEN: <personal_access_token>" \
--url "https://gitlab.example.com/api/v4/groups/1/-/packages/maven/foo/bar/mypkg/1.0-SNAPSHOT/mypkg-1.0-SNAPSHOT.jar"To write the output to file:
curl --header "PRIVATE-TOKEN: <personal_access_token>" \
--url "https://gitlab.example.com/api/v4/groups/1/-/packages/maven/foo/bar/mypkg/1.0-SNAPSHOT/mypkg-1.0-SNAPSHOT.jar" >> mypkg-1.0-SNAPSHOT.jarThis writes the downloaded file to mypkg-1.0-SNAPSHOT.jar in the current directory.
Download a package file for a project
Downloads a specified Maven package file for a project.
GET projects/:id/packages/maven/*path/:file_name| Attribute | Type | Required | Description |
|---|---|---|---|
path | string | yes | The Maven package path, in the format <groupId>/<artifactId>/<version>. Replace any . in the groupId with /. |
file_name | string | yes | The name of the Maven package file. |
curl --header "PRIVATE-TOKEN: <personal_access_token>" \
--url "https://gitlab.example.com/api/v4/projects/1/packages/maven/foo/bar/mypkg/1.0-SNAPSHOT/mypkg-1.0-SNAPSHOT.jar"To write the output to file:
curl --header "PRIVATE-TOKEN: <personal_access_token>" \
--url "https://gitlab.example.com/api/v4/projects/1/packages/maven/foo/bar/mypkg/1.0-SNAPSHOT/mypkg-1.0-SNAPSHOT.jar" >> mypkg-1.0-SNAPSHOT.jarThis writes the downloaded file to mypkg-1.0-SNAPSHOT.jar in the current directory.
Upload a package file
Uploads a specified Maven package file for a project.
PUT projects/:id/packages/maven/*path/:file_name| Attribute | Type | Required | Description |
|---|---|---|---|
path | string | yes | The Maven package path, in the format <groupId>/<artifactId>/<version>. Replace any . in the groupId with /. |
file_name | string | yes | The name of the Maven package file. |
curl --request PUT \
--upload-file path/to/mypkg-1.0-SNAPSHOT.pom \
--header "PRIVATE-TOKEN: <personal_access_token>" \
--url "https://gitlab.example.com/api/v4/projects/1/packages/maven/foo/bar/mypkg/1.0-SNAPSHOT/mypkg-1.0-SNAPSHOT.pom"