社区。
我有一个 Maven 包注册表托管在属于某个组的项目中。在该注册表中,我使用个人访问令牌手动上传了一个工件(pom 和 jar 文件)。
我有一个项目使用该包注册表中的该工件。因此,当我尝试执行测试阶段时,它失败并出现以下错误:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:3.1.2:get (default-cli) on project docker_receiver: Couldn't download artifact: org.eclipse.aether.resolution.DependencyResolutionException: Could not find artifact transparent_coach:maven_registry:jar:1.0.0 in gitlab-maven (https://gitlab.com/api/v4/projects/23241686/packages/maven)
这是我正在运行的测试阶段:
test:
stage: test
allow_failure: false
tags:
- docker
- dind
script:
- mvn --version
- echo "$TC_GITLAB_AUTH_SETTINGS" > settings.xml
- mvn dependency:get -Dartifact=transparent_coach:maven_registry:1.0.0
- mvn clean verify
Run Code Online (Sandbox Code Playgroud)
该settings.xml
文件存在,并且包含正确的结构,其个人令牌与我用于将工件上传到注册表的个人令牌相同。注册表和工件的参数pom.xml
是正确的:
<dependency>
<groupId>transparent_coach</groupId>
<artifactId>maven_registry</artifactId>
<version>1.0.0</version>
</dependency>
#----------------------
<repositories>
<repository>
<id>gitlab-maven</id>
<url>https://gitlab.com/api/v4/projects/23241686/packages/maven</url>
</repository>
</repositories>
<distributionManagement>
<repository> …
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用 SonarQube 7.9.1 CE Web API 从 Java Spring Boot 应用程序中的服务器检索一些信息,我从一个非常简单的信息开始:项目列表。
事实证明,我需要通过令牌或用户/密码组合提供我的身份信息。但官方文档和 StackOverflow 答案仅显示 CURL 请求作为示例:
curl -u admin:admin http://localhost:9000/api/components/search_projects
curl -u 9548utj958tju5498jt934: http://localhost:9000/api/components/search_projects
Run Code Online (Sandbox Code Playgroud)
我一直在尝试使用RestTemplate发送请求,但总是收到 401 UNAUTHORIZED 错误。
我应该如何发送用户令牌?在请求标头中?作为请求参数的一部分?没有人说。
我尝试使用Bearer 9548utj958tju5498jt934、Basic 9548utj958tju5498jt934通过Authorization标头来完成此操作,在请求中插入参数,但没有任何效果。
谢谢。