maven dependency: purge-local-repository вызывает ошибки разрешения зависимостей - PullRequest
0 голосов
/ 04 мая 2018
  • У меня есть родительское задание 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-api завершается с Failed 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 была создана банка снимков и отправлена ​​в Артефакторию.

Вот лог из 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 вместо ИЛИ
  • запустите задание jenkins для сборки my-internal-api из пользовательского интерфейса Jenkins.

Вот выдержка из журнала:

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).
...