Sonatype Nexus:无法将工件从/向nexus转移,拒绝访问,ReasonPhrase:禁止

问题描述 投票:0回答:1

我正在尝试建立一个Nexus maven proxy-repo并构建一个小型开源应用程序,以查看它是否通过我的本地nexus实例。

我有一个正在运行的Nexus本地实例,我在这个this lesson之后创建了一个maven-proxy-test remository

这是我的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>

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

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个回答
0
投票

通过将localhost添加到nonProxyHosts来工作

<nonProxyHosts>localhost|127.0.0.1</nonProxyHosts>
© www.soinside.com 2019 - 2024. All rights reserved.