[英]Maven private internal repository using JFrog Artifactory not downloading the required plugins automatically
我已經創建了一個私有本地 Maven 存儲庫,用於從中央 Maven 服務器進行依賴處理。 我從 JFrog 的 Maven 示例中獲取了一個示例項目來構建示例項目。
我已按照所有步驟設置存儲庫並使其能夠啟動和運行。 當我嘗試構建從https://github.com/jfrog/project-examples下載的應用程序並且項目是 maven-example 時,我收到以下錯誤。
**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 但它不起作用
我也嘗試過使用 maven 命令mvn dependency:purge-local-repository但這也沒有更新所需的插件。
現在,我們如何讓 maven 在構建時再次下載所有插件並將這些插件上傳到 JFrog Artifactory。
Also How to configure Maven settings.xml to download plugins which are not available in JFrog Artifactory / Private Internal Maven Repository and to get it from Maven Central Server ie, if a dependency is not available in Private Internal Maven Repository, Maven should download it from中央 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>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'
根據問題中提供的跟蹤,問題似乎與訪問 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,這可能導致請求失敗。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.