Commit a76fb6d8 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Make package uploading work and add some docs about feature

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent d07b8d17
# GitLab Maven Packages repository
## Configure project to use GitLab Maven Repository URL
To download packages from GitLab, you need `repository` section in your `pom.xml`.
```xml
<repositories>
<repository>
<id>gitlab-maven</id>
<url>https://gitlab.com/api/v4/projects/PROJECT_ID/packages/maven</url>
</repository>
</repositories>
```
To upload packages to GitLab, you need a `distributionManagement` section in your `pom.xml`.
```xml
<distributionManagement>
<snapshotRepository>
<id>gitlab-maven</id>
<url>https://gitlab.com/api/v4/projects/PROJECT_ID/packages/maven</url>
</snapshotRepository>
</distributionManagement>
```
In both examples, replace `PROJECT_ID` with your project ID.
If you have a private GitLab installation, replace `gitlab.com` with your domain name.
## Configure repository access
If a project is private, credentials will need to be provided for authorization.
The preferred way to do this, is by using a [personal access tokens][pat].
You can add a corresponding section to your `settings.xml` file:
```xml
<settings>
<servers>
<server>
<id>gitlab-maven</id>
<configuration>
<httpHeaders>
<property>
<name>Private-Token</name>
<value>REPLACE_WITH_YOUR_PRIVATE_TOKEN</value>
</property>
</httpHeaders>
</configuration>
</server>
</servers>
</settings>
```
[pat]: ../profile/personal_access_tokens.md
...@@ -77,13 +77,13 @@ module API ...@@ -77,13 +77,13 @@ module API
# Skip handling top level maven-metadata.xml for now # Skip handling top level maven-metadata.xml for now
# Also stop request if version in metadata file differs from one in URL # Also stop request if version in metadata file differs from one in URL
return unless version || version != params[:app_version] return if version.blank? || version != params[:app_version]
end end
package = Packages::Package.crate(project: user_project) package = Packages::Package.create(project: user_project)
metadata = ::Packages::MavenMetadatum.crate_by!( metadata = ::Packages::MavenMetadatum.create!(
project: package.project, package: package,
app_group: params[:app_group], app_group: params[:app_group],
app_name: params[:app_name], app_name: params[:app_name],
app_version: params[:app_version] app_version: params[:app_version]
......
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