Maven 无法从 Artifactory 存储库下载

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

我正在尝试将我们的 Jenkins 服务器连接到我们的 Artifactory 存储库以进行构建。我在办公室使用 Jenkins 服务器取得了成功,但在使用位于公司网络另一部分的 Jenkins 服务器时遇到了问题。

我已禁用该作业,进入工作区,并尝试直接使用

mvn

$ mvn clean
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO] 
[INFO] PROJ Generic Aggregate POM
[INFO] PROJ Generic Module
[INFO] PROJ Generic Features
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building PROJ Generic Aggregate POM 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
Downloading: http://repo.vegicorp.net/artifactory/plugins-release/org/apache/maven/plugins/maven-clean-plugin/2.4.1/maven-clean-plugin-2.4.1.pom

然后它在吐出来之前就冻结了:

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] PROJ Generic Aggregate POM ........................ FAILURE [2:06.295s]
[INFO] PROJ Generic Module ............................... SKIPPED
[INFO] PROJ Generic Features ............................. SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2:07.160s
[INFO] Finished at: Wed Feb 11 18:16:46 EST 2015
[INFO] Final Memory: 8M/149M
[INFO] ------------------------------------------------------------------------
[ERROR] Plugin org.apache.maven.plugins:maven-clean-plugin:2.4.1 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-clean-plugin:jar:2.4.1: Could not transfer artifact org.apache.maven.plugins:maven-clean-plugin:pom:2.4.1 from/to central (http://repo.vegicorp.net/artifactory/plugins-release): Connection to http://repo.vegicorp.net refused: Connection timed out -> [Help 1]
[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/PluginResolutionException
to

但是,如果我尝试通过

curl
获取该 URL,下载时不会出现任何问题。与
wget
相同:

$ curl http://repo.vegicorp.net/artifactory/plugins-release/org/apache/maven/plugins/maven-clean-plugin/2.4.1/maven-clean-plugin-2.4.1.pom
<?xml version='1.0' encoding='UTF-8'?>

<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.
-->

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

因此,我可以通过

wget
curl
访问该 URL,但 Maven 本身似乎在获取该 URL 时遇到问题。我在我的
proxy
中添加了
~/.m2/settings.xml
设置,但这似乎没有任何区别。我们最初将 Maven 存储库设置为从端口 80 重定向到端口 8080,但在 URL 中添加或删除端口号没有什么区别。
settings.xml
来自 Artifactory,它将为您生成它。同样的
settings.xml
在我们的办公室工作。

删除

settings.xml
可以让一切正常工作,因为它可以从标准 Maven 存储库下载。

我的

settings.xml

<?xml version="1.0" encoding="UTF-8"?>
<settings xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd" xmlns="http://maven.apache.org/SETTINGS/1.1.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <servers>
    <server>
      <username>dweintraub</username>
      <password>AP8SoMtGnYpACsAwZo5oqUCfSYP</password>
      <id>central</id>
    </server>
    <server>
      <username>dweintraub</username>
      <password>AP8SoMtGnYpACsAwZo5oqUCfSYP</password>
      <id>snapshots</id>
    </server>
  </servers>
  <profiles>
    <profile>
      <repositories>
        <repository>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
          <id>central</id>
          <name>libs-release</name>
          <url>http://repo.vegicorp.net/artifactory/libs-release</url>
        </repository>
        <repository>
          <snapshots />
          <id>snapshots</id>
          <name>libs-snapshot</name>
          <url>http://repo.vegicorp.net/artifactory/libs-snapshot</url>
        </repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
          <id>central</id>
          <name>plugins-release</name>
          <url>http://repo.vegicorp.net/artifactory/plugins-release</url>
        </pluginRepository>
        <pluginRepository>
          <snapshots />
          <id>snapshots</id>
          <name>plugins-snapshot</name>
          <url>http://repo.vegicorp.net/artifactory/plugins-snapshot</url>
        </pluginRepository>
      </pluginRepositories>
      <id>artifactory</id>
    </profile>
  </profiles>
  <activeProfiles>
    <activeProfile>artifactory</activeProfile>
  </activeProfiles>
</settings>

有一个文件

~/.m2/repositories/org/apache/maven/plugins/maven-clean-plugins/2.4.1/maven-clean-plugin-2.4.1.pom.lastUpdated
,其中包含以下内容:

#NOTE: This is an internal implementation file, its format can be changed without prior notice.
#Wed Feb 11 18:16:46 EST 2015
[email protected]\:3128>2f606e371a64780e100321226a9f68a38c8b7906@default-http\://repo.vegicorp.net/artifactory/plugins-release/.lastUpdated=1423695463870
2f606e371a64780e100321226a9f68a38c8b7906@default-http\://repo.vegicorp.net/artifactory/plugins-release/.lastUpdated=1423696543392
http\://repo.vegicorp.net/artifactory/plugins-release/.error=Could not transfer artifact org.apache.maven.plugins\:maven-clean-plugin\:pom\:2.4.1 from/to central (http\://repo.vegicorp.net/artifactory/plugins-release)\: Connection to http\://repo.vegicorp.net refused
http\://repo.fusesource.com/nexus/content/repositories/releases/.lastUpdated=1423694766347
http\://repo.vegicorp.net/artifactory/plugins-snapshot/.error=Could not transfer artifact org.apache.maven.plugins\:maven-clean-plugin\:pom\:2.4.1 from/to snapshots (http\://repo.vegicorp.net/artifactory/plugins-snapshot)\: Connection to http\://repo.vegicorp.net refused
2f606e371a64780e100321226a9f68a38c8b7906@default-http\://repo.vegicorp.net/artifactory/plugins-snapshot/.lastUpdated=1423696606400
http\://repo.fusesource.com/nexus/content/repositories/releases/.error=
http\://repo.vegicorp.net/artifactory/plugins-release/.error=Could not transfer artifact org.apache.maven.plugins\:maven-clean-plugin\:pom\:2.4.1 from/to central (http\://repo.vegicorp.net/artifactory/plugins-release)\: Failed to transfer file\: http\://repo.vegicorp.net/artifactory/plugins-release/org/apache/maven/plugins/maven-clean-plugin/2.4.1/maven-clean-plugin-2.4.1.pom. Return code is\: 504 , ReasonPhrase\:Gateway Time-out.

这看起来像是代理设置问题。您能否将 mvn help: effective-settings 的输出添加到问题中?谢谢!

我要哭了...

$ mvn help:effective-settings
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO] 
[INFO] PROJ Generic Aggregate POM
[INFO] PROJ Generic Module
[INFO] PROJ Generic Features
Downloading: http://repo.fusesource.com/nexus/content/repositories/releases/org/apache/maven/plugins/maven-deploy-plugin/2.7/maven-deploy-plugin-2.7.pom
Downloading: http://repo.vegicorp.net/artifactory/plugins-release/org/apache/maven/plugins/maven-deploy-plugin/2.7/maven-deploy-plugin-2.7.pom

然后它冻结并显示:

[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-deploy-plugin:2.7: Plugin org.apache.maven.plugins:maven-deploy-plugin:2.7 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-deploy-plugin:jar:2.7

抱歉。由于我的设置,我无法运行

mvn help:effective-settings
...

maven jenkins artifactory
1个回答
0
投票

但是我不知道为什么,但是在我重新启动nexus进程之后,甚至在它真正开始之前,maven下载进程仍在继续......

我的环境:centos 7,maven 3.6.3,java-1.8.0-openjdk-1.8.0.302

© www.soinside.com 2019 - 2024. All rights reserved.