Maven API
- Tier: Free, Premium, Ultimate
- Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated
This is the API documentation for Maven Packages.
This API is used by the Maven package manager client and is generally not meant for manual consumption.
For instructions on how to upload and install Maven packages from the GitLab package registry, see the Maven package registry documentation.
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 at the instance-level
Download a Maven package file:
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>" "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>" "https://gitlab.example.com/api/v4/packages/maven/foo/bar/mypkg/1.0-SNAPSHOT/mypkg-1.0-SNAPSHOT.jar" >> mypkg-1.0-SNAPSHOT.jar
This writes the downloaded file to mypkg-1.0-SNAPSHOT.jar
in the current directory.
Download a package file at the group-level
Download a Maven package file:
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>" "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>" "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.jar
This writes the downloaded file to mypkg-1.0-SNAPSHOT.jar
in the current directory.
Download a package file at the project-level
Download a Maven package file:
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>" "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>" "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.jar
This writes the downloaded file to mypkg-1.0-SNAPSHOT.jar
in the current directory.
Upload a package file
Upload a Maven package file:
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>" \
"https://gitlab.example.com/api/v4/projects/1/packages/maven/foo/bar/mypkg/1.0-SNAPSHOT/mypkg-1.0-SNAPSHOT.pom"
Docs
Edit this page to fix an error or add an improvement in a merge request.
Create an issue to suggest an improvement to this page.
Product
Create an issue if there's something you don't like about this feature.
Propose functionality by submitting a feature request.
Feature availability and product trials
View pricing to see all GitLab tiers and features, or to upgrade.
Try GitLab for free with access to all features for 30 days.
Get help
If you didn't find what you were looking for, search the docs.
If you want help with something specific and could use community support, post on the GitLab forum.
For problems setting up or using this feature (depending on your GitLab subscription).
Request support