首页 > 解决方案 > 带有 Tycho 构建的 Jenkins Artifactory 插件

问题描述

我正在尝试在 Jenkins 中创建一个使用 Maven/Tycho 构建 jar 文件并将 jar 发布到 Artifactory 中的 Maven 本地存储库中的作业。这是我的詹金斯文件:

node {
    def server
    def rtMaven
    def buildInfo
    stage("Prepare ...") {
        checkout([
            $class: 'GitSCM', 
            branches: [[name: '*/master']], 
            extensions: [
                [$class: 'RelativeTargetDirectory', relativeTargetDir: '.']
            ], 
            userRemoteConfigs: [
                [url: 'http://bitbucket:7990/scm/acme/acme-releng.git']
            ]
        ])
        checkout([
            $class: 'GitSCM', 
            branches: [[name: '*/master']], 
            extensions: [
                [$class: 'RelativeTargetDirectory', relativeTargetDir: 'acme']
            ], 
            userRemoteConfigs: [
                [url: 'http://bitbucket:7990/scm/acme/acme.git']
            ]
        ])
    }
    stage("Configure ...") {
        server = rtServer (
            id: 'acn-artifactory-server',
            url: 'http://192.168.178.26:8082/artifactory',
            username: 'admin',
            password: 'password',
            timeout: 300
        )
        rtMaven = Artifactory.newMavenBuild();


        rtMaven.resolver server: server, releaseRepo: 'acn-libs-release', snapshotRepo: 'acn-libs-snapshot'
        rtMaven.deployer server: server, releaseRepo: 'acn-libs-release-local', snapshotRepo: 'acn-libs-snapshot-local'

        rtMaven.deployer.artifactDeploymentPatterns.addExclude('acme/acme/.polyglot.build.properties')

        rtMaven.deployer.threads = 3      
        rtMaven.deployer.deployArtifacts = true  
    }

    stage ('Build ...') {
        buildInfo = rtMavenRun (
            tool: 'Maven 3.6.3', 
            pom: './pom.xml',
            goals: 'clean install')
        
    }
}

jar 已构建,但最后出现以下错误:

java.lang.IllegalArgumentException: File not found: /var/jenkins_home/workspace/acme/acme/.polyglot.build.properties
    at org.jfrog.build.extractor.clientConfiguration.deploy.DeployDetails$Builder.build(DeployDetails.java:142)
    at org.jfrog.hudson.pipeline.common.types.buildInfo.BuildInfo$DeployPathsAndPropsCallable.lambda$invoke$0(BuildInfo.java:378)
    at java.util.LinkedHashMap.forEach(LinkedHashMap.java:684)
    at org.jfrog.hudson.pipeline.common.types.buildInfo.BuildInfo$DeployPathsAndPropsCallable.invoke(BuildInfo.java:368)
    at org.jfrog.hudson.pipeline.common.types.buildInfo.BuildInfo$DeployPathsAndPropsCallable.invoke(BuildInfo.java:344)
    at hudson.FilePath.act(FilePath.java:1164)
    at hudson.FilePath.act(FilePath.java:1147)
    at org.jfrog.hudson.pipeline.common.types.buildInfo.BuildInfo.getAndAppendDeployableArtifactsByModule(BuildInfo.java:210)
    at org.jfrog.hudson.pipeline.common.executors.MavenExecutor.execute(MavenExecutor.java:83)
    at org.jfrog.hudson.pipeline.declarative.steps.maven.MavenStep$Execution.runStep(MavenStep.java:95)
    at org.jfrog.hudson.pipeline.declarative.steps.maven.MavenStep$Execution.runStep(MavenStep.java:80)
    at org.jfrog.hudson.pipeline.ArtifactorySynchronousNonBlockingStepExecution.run(ArtifactorySynchronousNonBlockingStepExecution.java:54)
    at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
Finished: FAILURE

我无法让 Artifactory 插件忽略丢失的文件。事实上,我真的很困惑,我不知道我是否不理解某些东西,因为我没有得到预期的结果。例如,如果我更改 Artifactory 服务器的 IP,我希望构建会立即失败,但事实并非如此。它还说部署和发布构建信息被禁用。

[main] INFO org.jfrog.build.extractor.maven.BuildDeploymentHelper - Artifactory Build Info Recorder: deploy artifacts set to false, artifacts will not be deployed...
[main] INFO org.jfrog.build.extractor.maven.BuildDeploymentHelper - Artifactory Build Info Recorder: publish build info set to false, build info will not be published...

有任何想法吗?

非常感谢

标签: jenkinsartifactorytycho

解决方案


推荐阅读