当前位置: 首页 > 知识库问答 >
问题:

云构建与JFrog艺术工厂

朱兴学
2023-03-14

我正在使用google cloud build来构建我的maven项目,并使用JFrog antifactory registry来存储maven工件。云中构建需要这些工件。我尝试了几部纪录片[1],[2]。但有时会出现很多错误。我可以带上最新的指南来集成云构建和JFrog antifactory吗。正确的身份验证方法需要使用用户名密码以外的其他方法。可以使用API密钥方法。

[1].https://github.com/GoogleCloudPlatform/cloud-builders-community/tree/master/jfrog

[2]. https://cloud.google.com/blog/products/application-development/integrating-google-cloud-build-with-jfrog-artifactory

编辑1

我把M2_HOME设置为MAVEN_HOME。然后这个问题就解决了。但新的错误被认为是不受支持的重大错误。次要版本52.0。这是java版本不匹配的常见问题。

错误消息:

Step #1: [Info] Running Mvn...
Step #1: [Info] The build-info-extractor jar is not cached locally. Downloading it now...
Step #1: You can set the repository from which this jar is downloaded. Read more about it at https://www.jfrog.com/confluence/display/CLI/CLI+for+JFrog+Artifactory#CLIforJFrogArtifactory-DownloadingtheMavenandGradleExtractorJARs
Step #1: [Info] Downloading build-info-extractor from https://oss.jfrog.org/artifactory/oss-release-local/org/jfrog/buildinfo/build-info-extractor-maven3/2.26.1/build-info-extractor-maven3-2.26.1-uber.jar
Step #1: [main] WARN Sisu - Error injecting: org.jfrog.build.extractor.maven.DependencyResolutionSpy
Step #1: java.lang.TypeNotPresentException: Type org.jfrog.build.extractor.maven.DependencyResolutionSpy not present
Step #1: at org.eclipse.sisu.space.URLClassSpace.loadClass(URLClassSpace.java:115)
Step #1: at org.eclipse.sisu.space.NamedClass.load(NamedClass.java:46)
Step #1: at org.eclipse.sisu.space.AbstractDeferredClass.get(AbstractDeferredClass.java:48)
Step #1: at com.google.inject.internal.ProviderInternalFactory.provision(ProviderInternalFactory.java:86)
Step #1: at com.google.inject.internal.InternalFactoryToInitializableAdapter.provision(InternalFactoryToInitializableAdapter.java:54)
Step #1: at com.google.inject.internal.ProviderInternalFactory$1.call(ProviderInternalFactory.java:70)
Step #1: at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision(ProvisionListenerStackCallback.java:113)
Step #1: at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision(ProvisionListenerStackCallback.java:129)
Step #1: at com.google.inject.internal.ProvisionListenerStackCallback.provision(ProvisionListenerStackCallback.java:68)
Step #1: at com.google.inject.internal.ProviderInternalFactory.circularGet(ProviderInternalFactory.java:68)
Step #1: at com.google.inject.internal.InternalFactoryToInitializableAdapter.get(InternalFactoryToInitializableAdapter.java:46)
Step #1: at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
Step #1: at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1066)
Step #1: at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
Step #1: at com.google.inject.Scopes$1$1.get(Scopes.java:59)
Step #1: at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:41)
Step #1: at com.google.inject.internal.InjectorImpl$2$1.call(InjectorImpl.java:1009)
Step #1: at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1066)
Step #1: at com.google.inject.internal.InjectorImpl$2.get(InjectorImpl.java:1005)
Step #1: at org.eclipse.sisu.inject.LazyBeanEntry.getValue(LazyBeanEntry.java:82)
Step #1: at org.eclipse.sisu.plexus.LazyPlexusBean.getValue(LazyPlexusBean.java:51)
Step #1: at org.eclipse.sisu.wire.EntryListAdapter$ValueIterator.next(EntryListAdapter.java:111)
Step #1: at java.util.AbstractCollection.toArray(AbstractCollection.java:141)
Step #1: at java.util.ArrayList.(ArrayList.java:164)
Step #1: at org.apache.maven.eventspy.internal.EventSpyDispatcher.setEventSpies(EventSpyDispatcher.java:49)
Step #1: at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
Step #1: at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
Step #1: at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
Step #1: at java.lang.reflect.Method.invoke(Method.java:606)
Step #1: at org.eclipse.sisu.bean.BeanPropertySetter.set(BeanPropertySetter.java:76)
Step #1: at org.eclipse.sisu.plexus.ProvidedPropertyBinding.injectProperty(ProvidedPropertyBinding.java:48)
Step #1: at org.eclipse.sisu.bean.BeanInjector.injectMembers(BeanInjector.java:52)
Step #1: at com.google.inject.internal.MembersInjectorImpl.injectMembers(MembersInjectorImpl.java:140)
Step #1: at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:117)
Step #1: at com.google.inject.internal.ConstructorInjector.access$000(ConstructorInjector.java:32)
Step #1: at com.google.inject.internal.ConstructorInjector$1.call(ConstructorInjector.java:92)
Step #1: at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision(ProvisionListenerStackCallback.java:113)
Step #1: at org.eclipse.sisu.bean.BeanScheduler$Activator.onProvision(BeanScheduler.java:176)
Step #1: at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision(ProvisionListenerStackCallback.java:122)
Step #1: at com.google.inject.internal.ProvisionListenerStackCallback.provision(ProvisionListenerStackCallback.java:68)
Step #1: at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:90)
Step #1: at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:269)
Step #1: at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
Step #1: at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1066)
Step #1: at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
Step #1: at com.google.inject.Scopes$1$1.get(Scopes.java:59)
Step #1: at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:41)
Step #1: at com.google.inject.internal.InjectorImpl$2$1.call(InjectorImpl.java:1009)
Step #1: at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1059)
Step #1: at com.google.inject.internal.InjectorImpl$2.get(InjectorImpl.java:1005)
Step #1: at org.eclipse.sisu.inject.LazyBeanEntry.getValue(LazyBeanEntry.java:82)
Step #1: at org.eclipse.sisu.plexus.LazyPlexusBean.getValue(LazyPlexusBean.java:51)
Step #1: at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:263)
Step #1: at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:255)
Step #1: at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:249)
Step #1: at org.apache.maven.cli.MavenCli.container(MavenCli.java:419)
Step #1: at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:210)
Step #1: at org.apache.maven.cli.MavenCli.main(MavenCli.java:160)
Step #1: at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
Step #1: at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
Step #1: at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
Step #1: at java.lang.reflect.Method.invoke(Method.java:606)
Step #1: at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
Step #1: at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
Step #1: at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
Step #1: at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Step #1: Caused by: java.lang.UnsupportedClassVersionError: org/jfrog/build/extractor/maven/DependencyResolutionSpy : Unsupported major.minor version 52.0
Step #1: at java.lang.ClassLoader.defineClass1(Native Method)
Step #1: at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
Step #1: at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
Step #1: at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
Step #1: at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
Step #1: at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
Step #1: at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
Step #1: at java.security.AccessController.doPrivileged(Native Method)
Step #1: at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
Step #1: at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClassFromSelf(ClassRealm.java:401)
Step #1: at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:42)
Step #1: at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:271)
Step #1: at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:247)
Step #1: at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:239)
Step #1: at org.eclipse.sisu.space.URLClassSpace.loadClass(URLClassSpace.java:107)
Step #1: ... 65 more
Step #1: [main] ERROR org.apache.maven.cli.MavenCli - Error executing Maven.
Step #1: [main] ERROR org.apache.maven.cli.MavenCli - com.google.inject.ProvisionException: Unable to provision, see the following errors:
Step #1:
Step #1: 1) Error injecting: public void org.apache.maven.eventspy.internal.EventSpyDispatcher.setEventSpies(java.util.List)
Step #1: at ClassRealm[plexus.core, parent: null] (via modules: org.eclipse.sisu.wire.WireModule -> org.eclipse.sisu.plexus.PlexusBindingModule)
Step #1: while locating org.apache.maven.eventspy.internal.EventSpyDispatcher
Step #1:
Step #1: 1 error
Step #1: role: org.apache.maven.eventspy.internal.EventSpyDispatcher
Step #1: roleHint:
Step #1: [main] ERROR org.apache.maven.cli.MavenCli - Caused by: Unable to provision, see the following errors:
Step #1:
Step #1: 1) Error injecting: public void org.apache.maven.eventspy.internal.EventSpyDispatcher.setEventSpies(java.util.List)
Step #1: at ClassRealm[plexus.core, parent: null] (via modules: org.eclipse.sisu.wire.WireModule -> org.eclipse.sisu.plexus.PlexusBindingModule)
Step #1: while locating org.apache.maven.eventspy.internal.EventSpyDispatcher
Step #1:
Step #1: 1 error
Step #1: [main] ERROR org.apache.maven.cli.MavenCli - Caused by: Unable to provision, see the following errors:
Step #1:
Step #1: 1) Error in custom provider, java.lang.TypeNotPresentException: Type org.jfrog.build.extractor.maven.DependencyResolutionSpy not present
Step #1: at ClassRealm[plexus.core, parent: null] (via modules: org.eclipse.sisu.wire.WireModule -> org.eclipse.sisu.plexus.PlexusBindingModule)
Step #1: at ClassRealm[plexus.core, parent: null] (via modules: org.eclipse.sisu.wire.WireModule -> org.eclipse.sisu.plexus.PlexusBindingModule)
Step #1: while locating org.apache.maven.eventspy.EventSpy
Step #1:
Step #1: 1 error
Step #1: [main] ERROR org.apache.maven.cli.MavenCli - Caused by: Type org.jfrog.build.extractor.maven.DependencyResolutionSpy not present
Step #1: [main] ERROR org.apache.maven.cli.MavenCli - Caused by: org/jfrog/build/extractor/maven/DependencyResolutionSpy : Unsupported major.minor version 52.0
Step #1: [Error] exit status 1

但是我的

project java版本:1.8

Maven版本:3.5.0

Maven docker图片:gcr。io/cloud builders/mvn:3.5.0-jdk-8

JFrog CLI版本: 1.48.0

这个错误是由于https://oss.jfrog.org/artifactory/oss-release-local/org/jfrog/buildinfo/build-info-extractor-maven3/2.26.1/build-info-extractor-maven3-2.26.1-uber.jar还是其他原因?

我如何解决这个问题?

共有1个答案

柳珂
2023-03-14

我使用maven设置xml文件解决了这个问题。我遵循以下步骤。

>

  • 创建maven设置。根目录中的xml。

     <servers>
         <server>
             <id>repo</id>
             <username>${server.username}</username>
             <password>${server.password}</password>
         </server>
     </servers>
    

    在谷歌云中创建密钥环和密钥。

    gcloud kms keyrings创建[KEYRING-NAME]——location=global

    gcloud kms密钥创建[KEY-NAME]——location=global——keyring=[keyring-NAME]——purpose=encryption

    使用上述钥匙圈和密钥加密JFrog用户名和密码

    USERNAME=aaa

    echo$USERNAME | gcloud kms encrypt--明文文件=--密文文件=--位置=全局--keyring=[keyring-NAME]--key=[key-NAME]| base64

    创建云构建文件以构建maven

    steps:
    - name: 'gcr.io/cloud-builders/mvn:3.5.0-jdk-8'
      entrypoint: 'bash'
      args: ['-c', 'mvn clean package -DskipTests=true -Dserver.username=$$USERNAME -Dserver.password=$$PASSWORD -s settings.xml -q']
      secretEnv: ['USERNAME', 'PASSWORD']
    
    secrets:
    - kmsKeyName: projects/[PROJECT]/locations/global/keyRings/jfrog/cryptoKeys/jfrog
      secretEnv:
        USERNAME: [ENCRYPTED-USERNAME]
    
        PASSWORD: [ENCRYPTED-PASSWORD]
    
    
    

  •  类似资料:
    • 现在虽然有很多指南,但是它们都是有一些问题的。我们不想介绍一些死板的规定,我们想提供一个在开发者们之间写更一致的代码的方法。随时间的推移,这本书开始转向介绍如何设计和构建优秀的代码。

    • 我们正在考虑使用Jenkins Artifactory插件及其Gradle集成,主要用于其许可证检查功能。在我们的例子中,我们不需要这个插件来向Artifactory发布任何工件,只需要构建信息和许可证检查信息。有没有办法配置插件来做到这一点?无论我做什么,它似乎总是在Gradle中运行artifactoryPublish任务。

    • 在创建adobe公共存储库的远程存储库时,我正在努力进行一个使用JFrog Artifictory云的简单测试。 我配置一个远程作为maven存储库,在URL我已经插入https://repo.adobe.com/nexus/content/repositories/public和测试确定的名称只是给一个adobe-public名称,并点击保存和完成。 在那之后,我试图从中获得一个现有的(在rep

    • 我有一个 spring-boot 项目的 gradle 构建作为 Jenkins 的工作。我正在使用 Jenkins 的 artifactory 插件将生成的 JAR 发布到我们的 artifactory 服务器。 构建成功完成并发布工件,但 Jenkins 控制台报告与 Artifactory 通信时出错(摘自下面列出的控制台)。 我使用的是Jenkins 1.597、artifactory插件

    • 接吻的艺术--为您提供了对接吻比较全面的认识。分为好处、指导、文化等板块。 讲解接吻的主要好处。(美容、护齿、免疫、减肥、止痛、减压、健康)。 指导 讲解接吻的练习、如何接吻、接吻的技巧、法式湿吻等。 文化 讲解比较全面的介绍了接吻的各个方面的知识。 我心永恒(背景音乐) 背景音乐,用于制造一个接吻的环境。 关于

    • 目前,我有一个Maven2项目,在运行时构建一个JAR: 我现在需要调整,以将此JAR()发布到运行于以下位置的ArtFactory服务器: 我尝试添加一个<代码> 关于如何让出版业开始工作,有什么想法吗?为了简单起见,假设这个人工repo经过身份验证,可以接受用户使用和进行的发布/写入。