首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >使用JFrog Artifactory的Maven私有内部存储库不会自动下载所需的插件

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

Stack Overflow用户
提问于 2020-05-20 05:43:05
回答 1查看 1.9K关注 0票数 1

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

我遵循了设置存储库的所有步骤,并能够对其进行组装和运行。当我试图构建从https://github.com/jfrog/project-examples下载的应用程序,并且项目是maven-示例时,我会得到以下错误。

代码语言:javascript
运行
复制
**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部署-U来尝试下载插件并将其上传到libs发行版,但是它没有工作

我也尝试使用maven命令mvn dependency:purge-local-repository,但这也没有更新所需的插件。

现在,我们如何让maven在构建插件时再次下载所有插件并将这些插件上传到JFrog Artifactory。

还如何配置Maven settings.xml以下载JFrog Artifactory /私有内部Maven Repository中不可用的插件,并从Maven Central Server获得它--也就是说,如果私有内部Maven Repository中没有依赖项,Maven应该从Central下载它。

请帮忙支援。

settings.xml文件

代码语言:javascript
运行
复制
<?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'
EN

回答 1

Stack Overflow用户

发布于 2020-05-27 07:53:13

根据问题中提供的跟踪,问题似乎是如何访问JCenter公共存储库。

跟踪中的以下行显示了本地缓存中请求的工件,并且Artifactory试图从JCenter请求它,但假设它脱机:

代码语言:javascript
运行
复制
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,这可能导致请求失败。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/61905881

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档