当前位置: 首页 > 知识库问答 >
问题:

使用JFrog Artifactory的Maven私有内部存储库没有自动下载所需的插件

公西俊德
2023-03-14

我创建了一个私有的本地Maven存储库,用于从中央Maven服务器处理依赖关系。我从JFrog的Maven示例中取了一个样例项目来构建样例项目。

我已经完成了设置存储库的所有步骤,并且能够完成并运行存储库。当我尝试构建从https://github.com/jfrog/project-examples下载的应用程序并且项目是maven-examples时,我得到以下错误。

**root@xyz:/home/asdf/Downloads/mavenrepository/project-examples/maven-example# mvn deploy -U**

[INFO] Scanning for projects...

[INFO] ------------------------------------------------------------------------

[INFO] Reactor Build Order:

[INFO]

[INFO] Simple Multi Modules Build                                         [pom]

[INFO] Multi 1                                                            [jar]

[INFO] Multi 2                                                            [jar]

[INFO] Multi 3                                                            [war]

[INFO]

[INFO] ------------------------< org.jfrog.test:multi >------------------------

[INFO] Building Simple Multi Modules Build 3.7-SNAPSHOT                   [1/4]

[INFO] --------------------------------[ pom ]---------------------------------

Downloading from central: http://localhost:8081/artifactory/libs-release/org/apache/maven/plugins/maven-install-plugin/2.4/maven-install-plugin-2.4.pom

Downloading from snapshots: http://localhost:8081/artifactory/libs-snapshot/org/apache/maven/plugins/maven-install-plugin/2.4/maven-install-plugin-2.4.pom

[WARNING] The POM for org.apache.maven.plugins:maven-install-plugin:jar:2.4 is missing, no dependency information available

Downloading from central: http://localhost:8081/artifactory/libs-release/org/apache/maven/plugins/maven-install-plugin/2.4/maven-install-plugin-2.4.jar

Downloading from snapshots: http://localhost:8081/artifactory/libs-snapshot/org/apache/maven/plugins/maven-install-plugin/2.4/maven-install-plugin-2.4.jar

[INFO] ------------------------------------------------------------------------

[INFO] Reactor Summary for Simple Multi Modules Build 3.7-SNAPSHOT:

[INFO]

[INFO] Simple Multi Modules Build ......................... FAILURE [  0.636 s]

[INFO] Multi 1 ............................................ SKIPPED

[INFO] Multi 2 ............................................ SKIPPED

[INFO] Multi 3 ............................................ SKIPPED

[INFO] ------------------------------------------------------------------------

[INFO] BUILD FAILURE

[INFO] ------------------------------------------------------------------------

[INFO] Total time:  0.750 s

[INFO] Finished at: 2020-05-20T03:00:55+02:00

[INFO] ------------------------------------------------------------------------

[ERROR] Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved: Could not find artifact org.apache.maven.plugins:maven-install-plugin:jar:2.4 in central (http://localhost:8081/artifactory/libs-release) -> [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

我已经运行了maven命令mvn deploy-u来尝试下载插件并将其上传到libs-release,但没有成功

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>xyz</username>
      <password>xyz_pass</password>
      <id>central</id>
    </server>
    <server>
      <username>admin</username>
      <password>admin_password</password>
      <id>snapshots</id>
    </server>
  </servers>
  <profiles>
    <profile>
      <repositories>
        <repository>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
          <id>central</id>
          <name>libs-release</name>
          <url>http://localhost:8081/artifactory/libs-release</url>       
        </repository>
        <repository>
          <snapshots />
          <id>snapshots</id>
          <name>libs-snapshot</name>
          <url>http://localhost:8081/artifactory/libs-snapshot</url>          
        </repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
          <id>central</id>
          <name>libs-release</name>
          <url>http://localhost:8081/artifactory/libs-release</url>             
        </pluginRepository>
        <pluginRepository>
          <snapshots />
          <id>snapshots</id>
          <name>libs-snapshot</name>
          <url>http://localhost:8081/artifactory/libs-snapshot</url>          
        </pluginRepository>
      </pluginRepositories>
      <id>artifactory</id>
    </profile>
  </profiles>
  <activeProfiles>
    <activeProfile>artifactory</activeProfile>
  </activeProfiles>
</settings>

Trace:
Request ID: 2ba338df
Repo Path ID: libs-release:org/apache/maven/plugins/maven-install-plugin/2.4/maven-install-plugin-2.4.pom
Method Name: GET
User: admin
Time: 2020-05-26T10:32:01.113+02:00
Thread: http-nio-8081-exec-9
Steps: 
2020-05-26T10:32:01.113+02:00 Received request
2020-05-26T10:32:01.114+02:00 Request source = 10.XXX.XXX.XXX, Last modified = 01-01-70 00:59:59 +01:00, If modified since = -1, Thread name = http-nio-8081-exec-9
2020-05-26T10:32:01.114+02:00 Executing any BeforeDownloadRequest user plugins that may exist
2020-05-26T10:32:01.114+02:00 Retrieving info from virtual repository 'libs-release' type Maven
2020-05-26T10:32:01.114+02:00 Consulting the virtual repo download strategy
2020-05-26T10:32:01.114+02:00 Trying to retrieve resource info from the local storage
2020-05-26T10:32:01.114+02:00 Unable to find resource in libs-release:org/apache/maven/plugins/maven-install-plugin/2.4/maven-install-plugin-2.4.pom
2020-05-26T10:32:01.114+02:00 Intercepting cached virtual resource with 'MavenMetadataInterceptor'
2020-05-26T10:32:01.114+02:00 Intercepting cached virtual resource with 'PomInterceptor'
2020-05-26T10:32:01.114+02:00 Searching for info in aggregated repositories
2020-05-26T10:32:01.114+02:00 Preparing list of aggregated repositories to search in
2020-05-26T10:32:01.114+02:00 Appending the nested virtual repository 'libs-release'
2020-05-26T10:32:01.115+02:00 Appending collective local repositories
2020-05-26T10:32:01.115+02:00 Appending collective local cache repositories
2020-05-26T10:32:01.115+02:00 Appending collective remote repositories
2020-05-26T10:32:01.115+02:00 Intercepting info request with 'MavenMetadataInterceptor'
2020-05-26T10:32:01.115+02:00 Intercepting info request with 'PomInterceptor'
2020-05-26T10:32:01.115+02:00 Processing request as a release resource
2020-05-26T10:32:01.115+02:00 Searching for the resource within libs-release-local
2020-05-26T10:32:01.115+02:00 Unable to find resource in libs-release-local:org/apache/maven/plugins/maven-install-plugin/2.4/maven-install-plugin-2.4.pom
2020-05-26T10:32:01.115+02:00 Searching for the resource within jcenter-cache
2020-05-26T10:32:01.115+02:00 Unable to find resource in jcenter-cache:org/apache/maven/plugins/maven-install-plugin/2.4/maven-install-plugin-2.4.pom
2020-05-26T10:32:01.115+02:00 Searching for the resource within jcenter
2020-05-26T10:32:01.116+02:00 Unable to find resource in jcenter-cache:org/apache/maven/plugins/maven-install-plugin/2.4/maven-install-plugin-2.4.pom
2020-05-26T10:32:01.116+02:00 Repository is assumed offline and the resource doesn't exist in the local cache - returning unfound resource
2020-05-26T10:32:01.116+02:00 Returning an unfound resource
2020-05-26T10:32:01.116+02:00 Requested resource is found = false
2020-05-26T10:32:01.116+02:00 Requested resource is blocked = false
2020-05-26T10:32:01.116+02:00 Request is HEAD = false
2020-05-26T10:32:01.116+02:00 Request is for a checksum = false
2020-05-26T10:32:01.116+02:00 Target repository is not remote or doesn't store locally = true
2020-05-26T10:32:01.116+02:00 Requested resource was not modified = false
2020-05-26T10:32:01.116+02:00 Responding with unfound resource
2020-05-26T10:32:01.116+02:00 Setting default response status to '404' reason to 'Resource not found'
2020-05-26T10:32:01.116+02:00 Response is an instance of UnfoundRepoResourceReason
2020-05-26T10:32:01.116+02:00 Configured to hide un-authorized resources = false
2020-05-26T10:32:01.116+02:00 Original response status is auth related = false
2020-05-26T10:32:01.116+02:00 Using original response status of '404' and message 'Could not find resource'
2020-05-26T10:32:01.116+02:00 Sending error with status 404 and message 'Could not find resource'
2020-05-26T10:32:01.116+02:00 Executing any AfterDownloadErrorAction user plugins that may exist
2020-05-26T10:32:01.116+02:00 Response code wasn't modified by the user plugins
2020-05-26T10:32:01.116+02:00 Sending response with the status '404' and the message 'Could not find resource'

共有1个答案

商棋
2023-03-14

根据问题中提供的跟踪,问题似乎与对JCenter公共存储库的访问有关。
跟踪中的以下行显示,请求的工件未在本地缓存,而Artifactory正试图从JCenter请求它,但假定它是脱机的:

2020-05-26T10:32:01.115+02:00 Searching for the resource within jcenter
2020-05-26T10:32:01.116+02:00 Unable to find resource in jcenter-cache:org/apache/maven/plugins/maven-install-plugin/2.4/maven-install-plugin-2.4.pom
2020-05-26T10:32:01.116+02:00 Repository is assumed offline and the resource doesn't exist in the local cache - returning unfound resource

这意味着Artifactory没有成功地访问jcenter几次,并最终将其标记为脱机。
这种情况可能有几个原因,包括如注释中所建议的,防火墙阻塞了到jcenter的传出流量。
排除故障的最佳方法是从存储库配置中获取jcenter存储库URL并确保您有网络访问它。
关于jcenter需要注意的一件事--最近,出于安全原因,它开始强制使用安全HTTP(https)。您的配置可能仍在使用非安全HTTP,这可能导致请求失败。

 类似资料:
  • 我试图在Eclipse JavaEE Indigo上安装它,我已经在另一台机器上成功地安装了它,但那是几个月的时间。 任何帮助都将不胜感激。

  • 我希望将Groovy支持添加到现有的java项目中,这样我就可以使用invokedynamic轻松地编译java和Groovy的混合代码,这样我就可以获得类似java的执行速度,而无需在冗长的java语法上浪费过多的时间 在读到gmaven插件不再支持编译,groovy eclipse编译器插件还不支持invokedynamic之后,我问自己,如果Maven编译的groovy代码速度太慢了,为什么

  • 因此,我在gitlab上有一个项目test-project(https://gitlab.com/group/test-project),这是一个我使用gitlab管道构建和部署的java应用程序。在构建阶段,我正在执行,包test-project.jar被推送到gitlab maven存储库(https://gitlab.com/group/test-project/-/packages)。 现

  • 我已经构建了Flink的快照版本,并希望将其部署到我的私有nexus存储库中。我尝试在pom中添加以下配置。xml 然后运行“mvn部署”命令。不幸的是,maven仍然试图将Flink的快照部署到官方存储库中: [错误]无法执行目标组织。阿帕奇。专家插件:maven部署插件:2.8.2:project上的部署(默认部署):未能部署工件:无法传输工件组织。阿帕奇。flink:force shadin

  • 那是外部存储代码,但我想保存在Android手机的内部存储。

  • 在Android中使用和iOS中使用下载存储文件,是否仍然在暗中使用下载uri方法,即在uri末尾使用不可猜测的标记? 我的要求禁止我们向世界公开这样的URL,所以问题是: null