我的目標是做一個從 Artifactory 下載最新 jar 的 Jenkins 作業。
我正在嘗試使用 Maven 默認命令clean
,install
但作業失敗。
Maven 應該從中下載它們,https://repo1.maven.org/maven2/
但 Jenkins 嘗試從我的本地 Artifactory 存盤庫下載它們http://localhost:8081/artifactory/bpidev/
。
詹金斯失敗日志:
Jenkins Artifactory Plugin version: 2.7.2
Artifactory integration is enabled
[S3_CbbCustom_Deploy_UAT] $ java -classpath /jenkins/jenkins/tools/hudson.tasks.Maven_MavenInstallation/Maven/boot/plexus-classworlds-2.6.0.jar -Dmaven.home=/jenkins/jenkins/tools/hudson.tasks.Maven_MavenInstallation/Maven -DbuildInfoConfig.propertiesFile=/tmp/buildInfo6009671373604071834.properties -Dm3plugin.lib=/jenkins/jenkins/cache/artifactory-plugin/2.7.2 -Dclassworlds.conf=/tmp/classworlds1010245859327507063conf -Dmaven.multiModuleProjectDirectory=/jenkins/jenkins/workspace/S3_CbbCustom_Deploy_UAT/pom.xml org.codehaus.plexus.classworlds.launcher.Launcher -f pom.xml install
[main] INFO org.apache.maven.cli.event.ExecutionEventLogger - Scanning for projects...
[main] INFO org.jfrog.build.extractor.maven.BuildInfoRecorderLifecycleParticipant - [buildinfo] Properties file found at '/tmp/buildInfo6009671373604071834.properties'
[main] INFO org.jfrog.build.extractor.maven.BuildInfoRecorder - Initializing Artifactory Build-Info Recording
[main] INFO org.apache.maven.cli.event.ExecutionEventLogger -
[main] INFO org.apache.maven.cli.event.ExecutionEventLogger - ------------------------< cbp.cbb:cbb-custom-3 >------------------------
[main] INFO org.apache.maven.cli.event.ExecutionEventLogger - Building cbb-custom-3 [4.3.3,)
[main] INFO org.apache.maven.cli.event.ExecutionEventLogger - --------------------------------[ jar ]---------------------------------
Downloading from central: http://localhost:8081/artifactory/bpidev/org/apache/maven/plugins/maven-resources-plugin/2.6/maven-resources-plugin-2.6.pom
[main] WARNING org.codehaus.plexus.PlexusContainer - The POM for org.apache.maven.plugins:maven-resources-plugin:jar:2.6 is missing, no dependency information available
Downloading from artifactory-release: http://localhost:8081/artifactory/bpidev/org/apache/maven/plugins/maven-resources-plugin/2.6/maven-resources-plugin-2.6.jar
[main] INFO org.apache.maven.cli.event.ExecutionEventLogger - ------------------------------------------------------------------------
[main] INFO org.apache.maven.cli.event.ExecutionEventLogger - BUILD FAILURE
[main] INFO org.apache.maven.cli.event.ExecutionEventLogger - ------------------------------------------------------------------------
[main] INFO org.apache.maven.cli.event.ExecutionEventLogger - Total time: 0.563 s
[main] INFO org.apache.maven.cli.event.ExecutionEventLogger - Finished at: 2022-05-02T15:02:03 08:00
[main] INFO org.apache.maven.cli.event.ExecutionEventLogger - ------------------------------------------------------------------------
[main] ERROR org.apache.maven.cli.MavenCli - Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its dependencies could not be resolved: Could not find artifact org.apache.maven.plugins:maven-resources-plugin:jar:2.6 in artifactory-release (http://localhost:8081/artifactory/bpidev/) -> [Help 1]
[main] ERROR org.apache.maven.cli.MavenCli -
[main] ERROR org.apache.maven.cli.MavenCli - To see the full stack trace of the errors, re-run Maven with the -e switch.
[main] ERROR org.apache.maven.cli.MavenCli - Re-run Maven using the -X switch to enable full debug logging.
[main] ERROR org.apache.maven.cli.MavenCli -
[main] ERROR org.apache.maven.cli.MavenCli - For more information about the errors and possible solutions, please read the following articles:
[main] ERROR org.apache.maven.cli.MavenCli - [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException
Build step 'Invoke Artifactory Maven 3' changed build result to FAILURE
Build step 'Invoke Artifactory Maven 3' marked build as failure
Finished: FAILURE
目標罐
詹金斯配置
我使用的 pom.xml
問題 1. 我的目標是做一個從 Artifactory 下載最新 jar 的 Jenkins 作業。
我做對了嗎?還是有更簡單的方法?
問題 2. 為什么 Maven 會在本地 Artifactory 搜索它的插件?連接點在哪里?
問題 3. 我可以讓 Maven 從 https://repo1.maven.org/maven2/下載它的插件嗎?還是我應該只上傳clean
并install
到我的 Artifactory 存盤庫?
uj5u.com熱心網友回復:
您的“解決方案發布存盤庫”配置似乎包含一個本地 Artifactory 存盤庫。相反,您應該將其指向一個虛擬存盤庫。
虛擬存盤庫將聚合您的本地存盤庫“bpidev”和另一個指向 https://repo1.maven.org/maven2/的遠程存盤庫。
Maven依賴于生成的settings.xml,所以如果它被配置為只指向'bpidev',他將無法訪問遠程存盤庫。
插件決議也通過 settings.xml 配置為“pluginRepository”,它還可以指向 Artifactory 中的同一虛擬存盤庫,該虛擬存盤庫可以聚合相同的遠程存盤庫,因此 Maven 將能夠下載插件。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/470035.html