我尝试从Gitlab Package Registry中提取包,但得到错误:无法找到group:package:0.0.18-SNAPSHOT。此软件包确实存在于软件包注册表中。
**我已经尝试使用gradle:**build.gradle:
repositories {
mavenCentral(),
maven {
url "https://gitlab.com/api/v4/groups/<group-id>/-/packages/maven"
name "GitLab"
credentials(HttpHeaderCredentials) {
name = "<deploy-token-username>"
value = "deploy-token-value"
}
authentication {
header(HttpHeaderAuthentication)
}
}
}
dependencies {
implementation("<group>:<package>:0.0.18-SNAPSHOT")
}
**使用maven:**pom.xml:
<repositories>
<repository>
<id>gitlab-maven</id>
<url>https://gitlab.com/api/v4/groups/<group-id>/-/packages/maven</url>
</repository>
</repositories>
<distributionManagement>
<repository>
<id>gitlab-maven</id>
<url>https://gitlab.com/api/v4/projects/<project-id>/packages/maven</url>
</repository>
<snapshotRepository>
<id>gitlab-maven</id>
<url>https://gitlab.com/api/v4/projects/<project-id>/packages/maven</url>
</snapshotRepository>
</distributionManagement>
<dependencies>
<dependency>
<groupId>group</groupId>
<artifactId>package</artifactId>
<version>0.0.18-SNAPSHOT</version>
</dependency>
</dependencies>
.../.m2/settings.xml:
<settings>
<servers>
<server>
<id>gitlab-maven</id>
<configuration>
<httpHeaders>
<property>
<name>deploy-token-username</name>
<value>deploy-token-value</value>
</property>
</httpHeaders>
</configuration>
</server>
</servers>
</settings>
1条答案
按热度按时间wydwbb8l1#
对于在gitlab中运行的作业,配置
ci_settings.xml
并使用属性名称Job-Token
在本地运行maven时,在
.m2/settings.xml
中使用Private-Token
属性名https://docs.gitlab.com/ee/user/packages/maven_repository/