Сбой при применении принудительного распознавателя артефактов

Отказ от ответственности: я не могу опубликовать полный pom.xml файл моего проекта здесь из-за ограничений неразглашения. Однако я извлек соответствующие части, чтобы проиллюстрировать проблему, с которой я сталкиваюсь. Моя организация недавно приобрела Artifactory, и я работаю над интеграцией автоматизированного конвейера сборки CI/CD в Gitlab, поэтому я пытался следовать официальному руководству на веб-сайте JFrog.

Команда, на которой происходит сбой конвейера, - это то, где он фактически вызывает maven (через CLI JFrog):

./jfrog rt mvn "clean compile install package -DskipTests" configuration.yml --build-name=gitlabci-maven-artifactory --build-number=$CI_JOB_ID

Появляющееся сообщение об ошибке выглядит примерно так. И это на самом деле просто висит после этого момента; CLI JFrog не возвращается с кодами выхода, поэтому мне приходится убивать конвейер Gitlab.

$ ./jfrog rt mvn "clean compile install package -DskipTests" configuration.yml --build-name=gitlabci-maven-artifactory --build-number=$CI_JOB_ID
[Info] Running Mvn...
[Info] Downloading jfrog/jfrog-jars/org/jfrog/buildinfo/build-info-extractor-maven3/2.9.2/build-info-extractor-maven3-2.9.2-uber.jar
[Info] [1]: 206 Partial Content...
[Info] [0]: 206 Partial Content...
[Info] [2]: 206 Partial Content...
[Info] Done downloading.
[Info] Downloaded 1 artifact.
...
[main] INFO org.apache.maven.cli.event.ExecutionEventLogger - Scanning for projects...
[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 - -------------------< com.mydomain:myproject >-------------------
[main] INFO org.apache.maven.cli.event.ExecutionEventLogger - Building MyProject 1.0.0
[main] INFO org.apache.maven.cli.event.ExecutionEventLogger - --------------------------------[ jar ]---------------------------------
[main] ERROR org.jfrog.build.extractor.maven.resolver.ArtifactoryEclipseRepositoryListener - Failed while enforcing Artifactory artifact resolver
org.codehaus.plexus.component.repository.exception.ComponentLookupException: java.util.NoSuchElementException
    role: org.jfrog.build.extractor.maven.resolver.ArtifactoryEclipseArtifactResolver
roleHint: 
    at org.codehaus.plexus.DefaultPlexusContainer.lookup (DefaultPlexusContainer.java:267)
    at org.codehaus.plexus.DefaultPlexusContainer.lookup (DefaultPlexusContainer.java:243)
    at org.codehaus.plexus.DefaultPlexusContainer.lookup (DefaultPlexusContainer.java:237)
    at org.jfrog.build.extractor.maven.resolver.ArtifactoryEclipseRepositoryListener.enforceArtifactoryResolver (ArtifactoryEclipseRepositoryListener.java:71)
    at org.jfrog.build.extractor.maven.resolver.ArtifactoryEclipseRepositoryListener.contextualize (ArtifactoryEclipseRepositoryListener.java:258)
    at org.eclipse.sisu.plexus.PlexusLifecycleManager.contextualize (PlexusLifecycleManager.java:282)
    at org.eclipse.sisu.plexus.PlexusLifecycleManager.activate (PlexusLifecycleManager.java:203)
    at org.eclipse.sisu.bean.BeanScheduler.schedule (BeanScheduler.java:151)
    at org.eclipse.sisu.plexus.PlexusLifecycleManager.manage (PlexusLifecycleManager.java:147)
    at org.eclipse.sisu.plexus.PlexusBeanBinder.afterInjection (PlexusBeanBinder.java:72)
    at com.google.inject.internal.MembersInjectorImpl.notifyListeners (MembersInjectorImpl.java:119)
    at com.google.inject.internal.ConstructorInjector.provision (ConstructorInjector.java:115)
    at com.google.inject.internal.ConstructorInjector.access$000 (ConstructorInjector.java:32)
    at com.google.inject.internal.ConstructorInjector$1.call (ConstructorInjector.java:89)
    at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision (ProvisionListenerStackCallback.java:115)
    at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision (ProvisionListenerStackCallback.java:133)
    at com.google.inject.internal.ProvisionListenerStackCallback.provision (ProvisionListenerStackCallback.java:68)
    at com.google.inject.internal.ConstructorInjector.construct (ConstructorInjector.java:87)
    at com.google.inject.internal.ConstructorBindingImpl$Factory.get (ConstructorBindingImpl.java:267)
    at com.google.inject.internal.InjectorImpl$2$1.call (InjectorImpl.java:1016)
    at com.google.inject.internal.InjectorImpl.callInContext (InjectorImpl.java:1103)
    at com.google.inject.internal.InjectorImpl$2.get (InjectorImpl.java:1012)
    at com.google.inject.internal.InjectorImpl.getInstance (InjectorImpl.java:1051)
    at org.eclipse.sisu.space.AbstractDeferredClass.get (AbstractDeferredClass.java:48)
    at com.google.inject.internal.ProviderInternalFactory.provision (ProviderInternalFactory.java:81)
    at com.google.inject.internal.InternalFactoryToInitializableAdapter.provision (InternalFactoryToInitializableAdapter.java:53)
    at com.google.inject.internal.ProviderInternalFactory$1.call (ProviderInternalFactory.java:65)
    at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision (ProvisionListenerStackCallback.java:115)
    at org.eclipse.sisu.bean.BeanScheduler$CycleActivator.onProvision (BeanScheduler.java:230)
    at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision (ProvisionListenerStackCallback.java:126)
    at com.google.inject.internal.ProvisionListenerStackCallback.provision (ProvisionListenerStackCallback.java:68)
    at com.google.inject.internal.ProviderInternalFactory.circularGet (ProviderInternalFactory.java:63)
    at com.google.inject.internal.InternalFactoryToInitializableAdapter.get (InternalFactoryToInitializableAdapter.java:45)
    at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call (ProviderToInternalFactoryAdapter.java:46)
    at com.google.inject.internal.InjectorImpl.callInContext (InjectorImpl.java:1103)
    at com.google.inject.internal.ProviderToInternalFactoryAdapter.get (ProviderToInternalFactoryAdapter.java:40)
    at com.google.inject.internal.SingletonScope$1.get (SingletonScope.java:145)
    at com.google.inject.internal.InternalFactoryToProviderAdapter.get (InternalFactoryToProviderAdapter.java:41)
    at com.google.inject.internal.InjectorImpl$2$1.call (InjectorImpl.java:1016)
    at com.google.inject.internal.InjectorImpl.callInContext (InjectorImpl.java:1092)
    at com.google.inject.internal.InjectorImpl$2.get (InjectorImpl.java:1012)
    at org.eclipse.sisu.inject.LazyBeanEntry.getValue (LazyBeanEntry.java:81)
    at org.eclipse.sisu.wire.EntrySetAdapter$ValueIterator.next (EntrySetAdapter.java:102)
    at org.eclipse.aether.internal.impl.DefaultRepositoryEventDispatcher.dispatch (DefaultRepositoryEventDispatcher.java:97)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.artifactResolving (DefaultArtifactResolver.java:640)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve (DefaultArtifactResolver.java:254)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts (DefaultArtifactResolver.java:224)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifact (DefaultArtifactResolver.java:201)
    at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom (DefaultArtifactDescriptorReader.java:261)
    at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.readArtifactDescriptor (DefaultArtifactDescriptorReader.java:192)
    at org.eclipse.aether.internal.impl.DefaultRepositorySystem.readArtifactDescriptor (DefaultRepositorySystem.java:253)
    at org.apache.maven.plugin.internal.DefaultPluginDependenciesResolver.resolve (DefaultPluginDependenciesResolver.java:103)
    at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getPluginDescriptor (DefaultMavenPluginManager.java:181)
    at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getMojoDescriptor (DefaultMavenPluginManager.java:286)
    at org.apache.maven.plugin.DefaultBuildPluginManager.getMojoDescriptor (DefaultBuildPluginManager.java:244)
    at org.apache.maven.lifecycle.internal.DefaultLifecycleMappingDelegate.calculateLifecycleMappings (DefaultLifecycleMappingDelegate.java:115)
    at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.calculateLifecycleMappings (DefaultLifecycleExecutionPlanCalculator.java:265)
    at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.calculateMojoExecutions (DefaultLifecycleExecutionPlanCalculator.java:216)
    at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.calculateExecutionPlan (DefaultLifecycleExecutionPlanCalculator.java:126)
    at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.calculateExecutionPlan (DefaultLifecycleExecutionPlanCalculator.java:144)
    at org.apache.maven.lifecycle.internal.builder.BuilderCommon.resolveBuildPlan (BuilderCommon.java:96)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:110)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:290)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:194)
    at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
Caused by: java.util.NoSuchElementException
    at java.util.Collections$EmptyIterator.next (Collections.java:4189)
    at org.codehaus.plexus.DefaultPlexusContainer.lookup (DefaultPlexusContainer.java:263)
    at org.codehaus.plexus.DefaultPlexusContainer.lookup (DefaultPlexusContainer.java:243)
    at org.codehaus.plexus.DefaultPlexusContainer.lookup (DefaultPlexusContainer.java:237)
    at org.jfrog.build.extractor.maven.resolver.ArtifactoryEclipseRepositoryListener.enforceArtifactoryResolver (ArtifactoryEclipseRepositoryListener.java:71)
    at org.jfrog.build.extractor.maven.resolver.ArtifactoryEclipseRepositoryListener.contextualize (ArtifactoryEclipseRepositoryListener.java:258)
    at org.eclipse.sisu.plexus.PlexusLifecycleManager.contextualize (PlexusLifecycleManager.java:282)
    at org.eclipse.sisu.plexus.PlexusLifecycleManager.activate (PlexusLifecycleManager.java:203)
    at org.eclipse.sisu.bean.BeanScheduler.schedule (BeanScheduler.java:151)
    at org.eclipse.sisu.plexus.PlexusLifecycleManager.manage (PlexusLifecycleManager.java:147)
    at org.eclipse.sisu.plexus.PlexusBeanBinder.afterInjection (PlexusBeanBinder.java:72)
    at com.google.inject.internal.MembersInjectorImpl.notifyListeners (MembersInjectorImpl.java:119)
    at com.google.inject.internal.ConstructorInjector.provision (ConstructorInjector.java:115)
    at com.google.inject.internal.ConstructorInjector.access$000 (ConstructorInjector.java:32)
    at com.google.inject.internal.ConstructorInjector$1.call (ConstructorInjector.java:89)
    at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision (ProvisionListenerStackCallback.java:115)
    at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision (ProvisionListenerStackCallback.java:133)
    at com.google.inject.internal.ProvisionListenerStackCallback.provision (ProvisionListenerStackCallback.java:68)
    at com.google.inject.internal.ConstructorInjector.construct (ConstructorInjector.java:87)
    at com.google.inject.internal.ConstructorBindingImpl$Factory.get (ConstructorBindingImpl.java:267)
    at com.google.inject.internal.InjectorImpl$2$1.call (InjectorImpl.java:1016)
    at com.google.inject.internal.InjectorImpl.callInContext (InjectorImpl.java:1103)
    at com.google.inject.internal.InjectorImpl$2.get (InjectorImpl.java:1012)
    at com.google.inject.internal.InjectorImpl.getInstance (InjectorImpl.java:1051)
    at org.eclipse.sisu.space.AbstractDeferredClass.get (AbstractDeferredClass.java:48)
    at com.google.inject.internal.ProviderInternalFactory.provision (ProviderInternalFactory.java:81)
    at com.google.inject.internal.InternalFactoryToInitializableAdapter.provision (InternalFactoryToInitializableAdapter.java:53)
    at com.google.inject.internal.ProviderInternalFactory$1.call (ProviderInternalFactory.java:65)
    at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision (ProvisionListenerStackCallback.java:115)
    at org.eclipse.sisu.bean.BeanScheduler$CycleActivator.onProvision (BeanScheduler.java:230)
    at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision (ProvisionListenerStackCallback.java:126)
    at com.google.inject.internal.ProvisionListenerStackCallback.provision (ProvisionListenerStackCallback.java:68)
    at com.google.inject.internal.ProviderInternalFactory.circularGet (ProviderInternalFactory.java:63)
    at com.google.inject.internal.InternalFactoryToInitializableAdapter.get (InternalFactoryToInitializableAdapter.java:45)
    at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call (ProviderToInternalFactoryAdapter.java:46)
    at com.google.inject.internal.InjectorImpl.callInContext (InjectorImpl.java:1103)
    at com.google.inject.internal.ProviderToInternalFactoryAdapter.get (ProviderToInternalFactoryAdapter.java:40)
    at com.google.inject.internal.SingletonScope$1.get (SingletonScope.java:145)
    at com.google.inject.internal.InternalFactoryToProviderAdapter.get (InternalFactoryToProviderAdapter.java:41)
    at com.google.inject.internal.InjectorImpl$2$1.call (InjectorImpl.java:1016)
    at com.google.inject.internal.InjectorImpl.callInContext (InjectorImpl.java:1092)
    at com.google.inject.internal.InjectorImpl$2.get (InjectorImpl.java:1012)
    at org.eclipse.sisu.inject.LazyBeanEntry.getValue (LazyBeanEntry.java:81)
    at org.eclipse.sisu.wire.EntrySetAdapter$ValueIterator.next (EntrySetAdapter.java:102)
    at org.eclipse.aether.internal.impl.DefaultRepositoryEventDispatcher.dispatch (DefaultRepositoryEventDispatcher.java:97)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.artifactResolving (DefaultArtifactResolver.java:640)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve (DefaultArtifactResolver.java:254)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts (DefaultArtifactResolver.java:224)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifact (DefaultArtifactResolver.java:201)
    at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom (DefaultArtifactDescriptorReader.java:261)
    at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.readArtifactDescriptor (DefaultArtifactDescriptorReader.java:192)
    at org.eclipse.aether.internal.impl.DefaultRepositorySystem.readArtifactDescriptor (DefaultRepositorySystem.java:253)
    at org.apache.maven.plugin.internal.DefaultPluginDependenciesResolver.resolve (DefaultPluginDependenciesResolver.java:103)
    at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getPluginDescriptor (DefaultMavenPluginManager.java:181)
    at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getMojoDescriptor (DefaultMavenPluginManager.java:286)
    at org.apache.maven.plugin.DefaultBuildPluginManager.getMojoDescriptor (DefaultBuildPluginManager.java:244)
    at org.apache.maven.lifecycle.internal.DefaultLifecycleMappingDelegate.calculateLifecycleMappings (DefaultLifecycleMappingDelegate.java:115)
    at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.calculateLifecycleMappings (DefaultLifecycleExecutionPlanCalculator.java:265)
    at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.calculateMojoExecutions (DefaultLifecycleExecutionPlanCalculator.java:216)
    at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.calculateExecutionPlan (DefaultLifecycleExecutionPlanCalculator.java:126)
    at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.calculateExecutionPlan (DefaultLifecycleExecutionPlanCalculator.java:144)
    at org.apache.maven.lifecycle.internal.builder.BuilderCommon.resolveBuildPlan (BuilderCommon.java:96)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:110)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:290)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:194)
    at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
[main] WARNING org.eclipse.aether.internal.impl.DefaultRepositoryEventDispatcher - Failed to dispatch repository event to org.jfrog.build.extractor.maven.resolver.ArtifactoryEclipseRepositoryListener: null
Downloading from central: http://repo1.maven.org/maven2/org/springframework/boot/spring-boot-maven-plugin/2.0.1.RELEASE/spring-boot-maven-plugin-2.0.1.RELEASE.pom
Progress (1): 4.1/4.8 kB
Progress (1): 4.8 kB    

Downloaded from central: http://repo1.maven.org/maven2/org/springframework/boot/spring-boot-maven-plugin/2.0.1.RELEASE/spring-boot-maven-plugin-2.0.1.RELEASE.pom (4.8 kB at 226 kB/s)

В моем файле POM я ссылаюсь на репозиторий Maven Central вместе с Artifactory как libs-release а также libs-snapshot, я использую libs-release-local а также libs-snapshot-local в <distributionManagement> раздел. Кажется, что он загружает все зависимости ОК; Однако я не уверен, почему это зависает на этом ArtifactoryEclipseArtifactResolver немного.

Я не совсем уверен, как поступить. Это довольно ясно похоже на проблему с CLI JFrog (или, возможно, так, как я это называю), так как я могу запустить обычный Maven в своей локальной системе и заставить все работать. Но я не уверен, как это исправить и заставить работать CI/CD.

1 ответ

Решение

У меня была такая же проблема при использовании конвейера Jenkins для развертывания артефактов в Artifactory. Я смог решить эту проблему с помощью плагина Artifactory maven. Ниже пример

<plugin>
                    <groupId>org.jfrog.buildinfo</groupId>
                    <artifactId>artifactory-maven-plugin</artifactId>
                    <version>2.6.1</version>
                    <executions>
                        <execution>
                            <id>build-info</id>
                            <goals>
                                <goal>publish</goal>
                            </goals>
                            <configuration>
                                <artifactory>
                                    <includeEnvVars>true</includeEnvVars>
                                    <envVarsExcludePatterns>*password*,*secret*,*key*,*token*,*passphrase*</envVarsExcludePatterns>
                                    <timeoutSec>60</timeoutSec>
                                </artifactory>
                                <publisher>
                                    <contextUrl>http://domain.name:not_a_default_port/artifactory/</contextUrl>
                                    <username>${username}</username> <!-- provided as env var -->
                                    <password>${password}</password> <!-- provided as env var -->
                                    <excludePatterns>*-tests.jar</excludePatterns>
                                    <repoKey>libs-release-local</repoKey>
                                    <snapshotRepoKey>libs-snapshot-local</snapshotRepoKey>
                                </publisher>
                                <buildInfo>
                                    <buildName>${project.build.finalName}</buildName>
                                    <buildNumber>${project.version}</buildNumber>
                                    <buildUrl>https://fontys.nl/uitschrijven</buildUrl>
                                </buildInfo>
                            </configuration>
                        </execution>

                    </executions>
                </plugin>

При использовании этого плагина я создал следующий шаг в Jenkinsfile:

stage ('Deploy to Artifactory') {
    steps {
        withMaven(
            maven: 'MAVEN_VERSION_CONFIGURED_IN_JENKINS',
            mavenSettingsConfig: 'optional config file id'
        ) {
            sh 'mvn deploy -Dusername=aaa -Dpassword=bbb -Dbuildnumber=ccc'
        }
    }
}
Другие вопросы по тегам