尝试从 Artifactory 下载 JAR。 Maven 搜索本地存储库而不是 public maven 服务器

Trying to download JAR from Artifactory. Maven searches local repository instead of public maven server

我的目标是做一个 Jenkins 工作,从 Artifactory 下载最新的 jar。
我正在尝试使用 Maven 默认命令 cleaninstall 但作业失败。
Maven 应该从 https://repo1.maven.org/maven2/ 下载它们,但 Jenkins 试图从我的本地 Artifactory 存储库 http://localhost:8081/artifactory/bpidev/.

下载它们

Jenkins 失败日志 :

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。我的目标是做一个 Jenkins 作业,从 Artifactory 下载最新的 jar。
我做对了吗?或者有更简单的方法吗?

问题2.为什么Maven要在本地Artifactory中寻找插件?连接在哪里?

问题3.我可以让Maven从https://repo1.maven.org/maven2/下载它的插件吗?或者我应该只将 cleaninstall 上传到我的 Artifactory 存储库?

您的 'Resolution release repository' 配置似乎包含本地 Artifactory 存储库。 相反,您应该将它指向一个虚拟存储库。

Virtual repositories will aggregate your local repository 'bpidev' and another remote repository which will point to https://repo1.maven.org/maven2/.

Maven 依赖于生成的 settings.xml,所以如果它被配置为仅指向 'bpidev',他将无法访问远程存储库。

插件解析也通过 settings.xml 配置为 'pluginRepository',它也可以指向 Artifactory 中的相同虚拟存储库,它可以聚合相同的远程存储库,因此 Maven 将能够下载插件.