maven依赖:purge-local-repository导致依赖项解析错误

时间:2018-05-03 21:02:15

标签: java maven jenkins dependencies

  • 我有一个父Jenkins工作(my-build-all),它连续调用2个child-maven-build-jobs(my-services后跟my-internal-api)(等待之前完成,然后再开始下)。
  • 两个版本都在同一台机器上发生,它们共享本地仓库。
  • my-internal-api取决于my-services
  • my-internal-api的目标是:dependency:purge-local-repository clean install
  • my-internal-apiFailed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.8:purge-local-repository (default-cli) on project my-internal-api: Failed to refresh project dependencies for: com.kashyap:my-internal-api:jar:1.0-r0.0-SNAPSHOT: required artifacts missing:....com.kashyap:my-services:jar:1.0-r0.0-SNAPSHOT....for the artifact:....com.kashyap:my-internal-api:jar:1.0-r0.0-SNAPSHOT
  • 失败
  • 我确信在my-services作业结束时,快照jar已构建并推送到Artifactory。

以下是my-services build:

的日志
[main] INFO org....ExecutionEventLogger - --- maven-install-plugin:2.4:install (default-install) @ my-services ---
[main] INFO org....PlexusContainer - Installing /home/ec2-user/workspace/my/Test/1. my-service/target/my-services-1.0-r0.0-SNAPSHOT.jar to /home/ec2-user/.m2/repository/com/kashyap/my-services/1.0-r0.0-SNAPSHOT/my-services-1.0-r0.0-SNAPSHOT.jar
[main] INFO org....PlexusContainer - Installing /home/ec2-user/workspace/my/Test/1. my-service/dependency-reduced-pom.xml to /home/ec2-user/.m2/repository/com/kashyap/my-services/1.0-r0.0-SNAPSHOT/my-services-1.0-r0.0-SNAPSHOT.pom
[main] INFO org....BuildInfoClientBuilder - Deploying artifact: http://artifactory.xxx.local/artifactory/libs-snapshot-local/com/kashyap/my-services/1.0-r0.0-SNAPSHOT/my-services-1.0-r0.0-SNAPSHOT.jar
[main] INFO org....BuildInfoClientBuilder - Deploying artifact: http://artifactory.xxx.local/artifactory/libs-snapshot-local/com/kashyap/my-services/1.0-r0.0-SNAPSHOT/my-services-1.0-r0.0-SNAPSHOT.pom
[main] INFO org....ExecutionEventLogger - ------------------------------------------------------------------------
[main] INFO org....ExecutionEventLogger - BUILD SUCCESS
[main] INFO org....ExecutionEventLogger - ------------------------------------------------------------------------
[main] INFO org....ExecutionEventLogger - Total time: 35.123 s
[main] INFO org....ExecutionEventLogger - Finished at: 2018-05-03T20:18:21+00:00
[main] INFO org....ExecutionEventLogger - Final Memory: 37M/432M
[main] INFO org....ExecutionEventLogger - ------------------------------------------------------------------------
[Pipeline] stage (Push Artifactory)
Using the ‘stage’ step without a block argument is deprecated
Entering stage Push Artifactory
Proceeding
[Pipeline] publishBuildInfo
Deploying build info to: http://artifactory.xxx.local/artifactory/api/build
Build successfully deployed. Browse it in Artifactory under http://artifactory.xxx.local/artifactory/webapp/builds/my%20::%20Test%20::%201.%20my-service/125

我在以下情况下工作正常:

  • 使用-U clean install代替OR
  • 运行
  • 启动jenkins作业,从Jenkins UI构建my-internal-api

以下是日志摘录:

Started by upstream project "my/Test/0. my-build-all" build number 5
+ mvn -version
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T16:41:47+00:00)
Maven home: /home/ec2-user/tools/hudson.tasks.Maven_MavenInstallation/M3
Java version: 1.8.0_171, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.171-7.b10.37.amzn1.x86_64/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "4.4.23-31.54.amzn1.x86_64", arch: "amd64", family: "unix"
Artifactory integration is enabled
[6. my-internal-api-mainline] $ java -classpath /home/ec2-user/tools/hudson.tasks.Maven_MavenInstallation/M3/boot/plexus-classworlds-2.5.2.jar -Dmaven.home=/home/ec2-user/tools/hudson.tasks.Maven_MavenInstallation/M3 -DbuildInfoConfig.propertiesFile=/tmp/buildInfo2752604435492193670.properties -Dm3plugin.lib=/home/ec2-user/cache/artifactory-plugin/2.10.3 -Dclassworlds.conf=/tmp/classworlds7843212232814826583conf "-Dmaven.multiModuleProjectDirectory=/home/ec2-user/workspace/my/Test/6. my-internal-api-mainline" org.codehaus.plexus.classworlds.launcher.Launcher -f pom.xml -X dependency:purge-local-repository clean install
[main] DEBUG org....DefaultUpdateCheckManager - Skipped remote request for com.kashyap:my-services:1.0-r0.0-SNAPSHOT/maven-metadata.xml, locally installed metadata up-to-date.
[main] DEBUG org....ArtifactoryEclipseRepositoryListener - [buildinfo] Resolved artifact: com.kashyap:my-services:pom:1.0-r0.0-SNAPSHOT:project from: /home/ec2-user/.m2/repository (enhanced) Context is: project
[main] DEBUG org....DefaultUpdateCheckManager - Skipped remote request for com.kashyap:my-services:1.0-r0.0-SNAPSHOT/maven-metadata.xml, locally installed metadata up-to-date.
[main] DEBUG org....ArtifactoryEclipseRepositoryListener - [buildinfo] Resolved artifact: com.kashyap:my-services:jar:1.0-r0.0-SNAPSHOT:project from: /home/ec2-user/.m2/repository (enhanced) Context is: project
[main] INFO org....PurgeLocalRepositoryMojo - Purging artifact: com.kashyap:my-services:jar:1.0-r0.0-SNAPSHOT
[main] INFO org....PurgeLocalRepositoryMojo - Deleting: /home/ec2-user/.m2/repository/com/kashyap/my-services/1.0-r0.0-SNAPSHOT

[main] DEBUG org....DefaultArtifactResolver -   com.kashyap:my-services:jar:1.0-r0.0-SNAPSHOT:compile (selected for compile)
[main] DEBUG org....ArtifactoryEclipseRepositoryListener - [buildinfo] Could not resolve artifact: com.kashyap:my-services:pom:1.0-r0.0-SNAPSHOT:project
[main] INFO org....plugin.dependency.PurgeLocalRepositoryMojo - Could not find artifact com.kashyap:my-services:pom:1.0-r0.0-SNAPSHOT
[main] INFO org.apache.maven.plugin.dependency.PurgeLocalRepositoryMojo - Resolving artifact: com.kashyap:my-services:jar:1.0-r0.0-SNAPSHOT
[main] DEBUG org....ArtifactoryEclipseRepositoryListener - [buildinfo] Could not resolve artifact: com.kashyap:my-services:jar:1.0-r0.0-SNAPSHOT:project
[main] INFO org....plugin.dependency.PurgeLocalRepositoryMojo - Could not find artifact com.kashyap:my-services:jar:1.0-r0.0-SNAPSHOT
[main] ERROR org....cli.MavenCli - Failed to execute goal org....plugins:maven-dependency-plugin:2.8:purge-local-repository (default-cli) on project my-internal-api: Failed to refresh project dependencies for: com.kashyap:my-internal-api:jar:1.0-r0.0-SNAPSHOT: required artifacts missing:
[main] ERROR org....cli.MavenCli - com.kashyap:my-services:jar:1.0-r0.0-SNAPSHOT
[main] ERROR org....cli.MavenCli - for the artifact:
[main] ERROR org....cli.MavenCli - com.kashyap:my-internal-api:jar:1.0-r0.0-SNAPSHOT

任何想法为什么maven是:

  • 查找my-services的本地快照版本为最新
  • 清除/删除它然后
  • 抱怨它无法解决(虽然我认为它是重新解决期间的purge-local-repository目标的一部分,而不是compile目标的一部分。 / LI>

0 个答案:

没有答案