【问题标题】:Sonatype Nexus: Could not transfer artifact from/to nexus, Access denied to, ReasonPhrase: ForbiddenSonatype Nexus:无法将工件从 / 转移到 nexus,拒绝访问,ReasonPhrase:禁止
【发布时间】:2019-03-14 09:03:57
【问题描述】:

我正在尝试设置一个 Nexus maven 代理存储库并构建一个小型开源应用程序以查看它是否通过我的本地 nexus 实例。

我有一个正在运行的 Nexus 本地实例,并且我在 this lesson 之后创建了一个 maven-proxy-test 存储库

这是我的 settings.xml:

<settings>
  <mirrors>
    <mirror>
      <!--This sends everything else to /public -->
      <id>nexus</id>
      <mirrorOf>*</mirrorOf>
      <url>http://localhost:8081/repository/maven-proxy-test/</url>
    </mirror>
  </mirrors>
  <profiles>
    <profile>
      <id>nexus</id>
      <!--Enable snapshots for the built in central repo to direct -->
      <!--all requests to nexus via the mirror -->
      <repositories>
        <repository>
          <id>central</id>
          <url>http://localhost:8081/repository/maven-proxy-test/</url>
          <releases><enabled>true</enabled></releases>
          <snapshots><enabled>true</enabled></snapshots>
        </repository>
      </repositories>
     <pluginRepositories>
        <pluginRepository>
          <id>central</id>
          <url>http://localhost:8081/repository/maven-proxy-test/</url>
          <releases><enabled>true</enabled></releases>
          <snapshots><enabled>true</enabled></snapshots>
        </pluginRepository>
      </pluginRepositories>
    </profile>
  </profiles>
  <activeProfiles>
    <!--make the profile active all the time -->
    <activeProfile>nexus</activeProfile>
  </activeProfiles>
    <proxies>
   <proxy>
      <id>ullink-proxy-id</id>
      <active>true</active>
      <protocol>http</protocol>
      <host>proxy.ullink.lan</host>
      <port>9876</port>
      <nonProxyHosts>*.ullink.lan</nonProxyHosts>
    </proxy>
    <proxy>
      <id>ullink-proxy-id2</id>
      <active>true</active>
      <protocol>https</protocol>
      <host>proxy.ullink.lan</host>
      <port>9876</port>
      <nonProxyHosts>*.ullink.lan</nonProxyHosts>
    </proxy>
  </proxies>
</settings>

然后我克隆了thisjenkins插件并尝试运行

mvn package

输出是:

[INFO] Scanning for projects...
Downloading: http://localhost:8081/repository/maven-proxy-test/org/jenkins-ci/plugins/plugin/3.1/plugin-3.1.pom
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[FATAL] Non-resolvable parent POM for org.jenkins-ci.plugins:parameterized-trigger:2.35.3-SNAPSHOT: Could not transfer artifact org.jenkins-ci.plugins:plugin:pom:3.1 from/to nexus (http://localhost:8081/repository/maven-proxy-test/): Access denied to: http://localhost:8081/repository/maven-proxy-test/org/jenkins-ci/plugins/plugin/3.1/plugin-3.1.pom , ReasonPhrase:Forbidden. and 'parent.relativePath' points at no local POM @ line 4, column 13
 @ 
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]   
[ERROR]   The project org.jenkins-ci.plugins:parameterized-trigger:2.35.3-SNAPSHOT (C:\projects\parameterized-trigger-plugin\pom.xml) has 1 error
[ERROR]     Non-resolvable parent POM for org.jenkins-ci.plugins:parameterized-trigger:2.35.3-SNAPSHOT: Could not transfer artifact org.jenkins-ci.plugins:plugin:pom:3.1 from/to nexus (http://localhost:8081/repository/maven-proxy-test/): Access denied to: http://localhost:8081/repository/maven-proxy-test/org/jenkins-ci/plugins/plugin/3.1/plugin-3.1.pom , ReasonPhrase:Forbidden. and 'parent.relativePath' points at no local POM @ line 4, column 13 -> [Help 2]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
[ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/UnresolvableModelException

附:我支持我在 Nexus Administrator 中配置的公司代理。 非常感谢任何帮助!

【问题讨论】:

    标签: maven package repository nexus sonatype


    【解决方案1】:

    通过将 localhost 添加到 nonProxyHosts 来工作

    <nonProxyHosts>localhost|127.0.0.1</nonProxyHosts>
    

    【讨论】:

      猜你喜欢
      • 2015-02-14
      • 1970-01-01
      • 2017-07-04
      • 2023-03-29
      • 1970-01-01
      • 2014-07-05
      • 1970-01-01
      • 1970-01-01
      • 2016-08-03
      相关资源
      最近更新 更多