无法传输工件-未经授权

Ere*_*evi 5 authorization repository maven

我想使用以下存储库中的工件“ eu.excitementproject:lap:jar:1.1.0:”:

http://hlt-services4.fbk.eu:8080/artifactory/repo/eu/excitementproject
Run Code Online (Sandbox Code Playgroud)

我可以直接从上面的链接下载jar,无需任何授权。

但是,当我在计算机上安装mvn时,出现以下错误:

Could not transfer artifact eu.excitementproject:lap:pom:1.1.0 from/to excitement 
(http://hlt-services4.fbk.eu:8080/artifactory/repo/eu/excitementproject): 
Not authorized
Run Code Online (Sandbox Code Playgroud)

这是我的pom.xml的相关部分:

  <repositories>
    <repository>
      <id>excitement</id>
      <name>excitement</name>
      <url>http://hlt-services4.fbk.eu:8080/artifactory/repo/eu/excitementproject</url>
    </repository>
  </repositories>

  <dependencies>
        <dependency>
            <groupId>eu.excitementproject</groupId>
            <artifactId>lap</artifactId>
            <version>1.1.0</version>
        </dependency>
  </dependencies>
Run Code Online (Sandbox Code Playgroud)

我该怎么办?

man*_*ish 6

您的 Maven 配置是:

  1. 存储库 URL - http://hlt-services4.fbk.eu:8080/artifactory/repo/eu/excitementproject
  2. 组 ID - eu.excitementproject
  3. 工件 ID - lap
  4. 神器版本 - 1.1.1.

因此,工件的完整路径是http://hlt-services4.fbk.eu:8080/artifactory/repo/eu/excitementproject/eu.excitementproject/lap/1.1.1/lap-1.1.1.pom.

如果我从任何 Web 浏览器点击此 URL,我将被要求使用基本 HTTP 身份验证进行身份验证。这也正是 Maven 所看到的。因此,正如上面@Will 所提到的,如果您希望继续使用此存储库 URL,则必须在本地 settings.xml 中为存储库配置身份验证设置。

有趣的是,我可以http://hlt-services4.fbk.eu:8080/artifactory/repo/eu.excitementproject/lap/1.1.1/lap-1.1.1.pom毫无问题地击球。因此,如果您将存储库 URL 缩短为http://hlt-services4.fbk.eu:8080/artifactory/repo,则您的构建将起作用(我已经对此进行了测试)。