简体   繁体   English

Jenkins Artifactory插件在Maven构建期间未检测到我的编译器

[英]Jenkins Artifactory plugin not detecting my compiler during maven build

I am currently trying to get a pipeline going using the artifactory Jenkins plugin. 我目前正在尝试使用人工的Jenkins插件进行处理。 When I use the plugin as a buildstep in a jenkins freestyle project, it works perfectly. 当我在jenkins自由式项目中将插件用作构建步骤时,它可以完美工作。 When I run maven directly from within the pipeline, it works perfectly. 当我直接在管道中运行maven时,它可以完美运行。 When I run maven through the Artifactory plugin using the script below, it fails. 当我使用以下脚本通过Artifactory插件运行maven时,它失败。 The error I get is: 我得到的错误是:

No compiler is provided in this environment. 在此环境中不提供编译器。 Perhaps you are running on a JRE rather than a JDK? 也许您是在JRE而不是JDK上运行?

This is my current script: 这是我当前的脚本:

node {

    stage ('clone') {
        git credentialsId: 'git', url: '<URL to GIT repo>'
    }

    stage ('build and deploy') {
        env.JAVA_HOME="${tool 'JDK8'}"
        env.PATH="${env.JAVA_HOME}/bin:${env.PATH}"

        def server = Artifactory.server "arti-test"
        def buildInfo = Artifactory.newBuildInfo()
        buildInfo.env.capture = true
        def rtMaven = Artifactory.newMavenBuild()
        rtMaven.tool = 'M3'
        rtMaven.resolver server: server, releaseRepo: 'libs-release', snapshotRepo: 'libs-snapshot'
        rtMaven.deployer server: server, releaseRepo: 'libs-release-local', snapshotRepo: 'libs-snapshot-local'

        rtMaven.run pom: 'pom.xml', goals: 'clean install', buildInfo: buildInfo

        buildInfo.retention maxBuilds: 10, maxDays: 7, deleteBuildArtifacts: true
        server.publishBuildInfo buildInfo
    }

}

The next release of the Jenkins Artifactory Plugin will include an API for setting the JDK to be used for Maven and Gradle Pipeline builds. Jenkins Artifactory插件的下一版本将包括一个API,用于设置JDK以用于Maven和Gradle Pipeline构建。 See this issue that tracks this task: https://www.jfrog.com/jira/browse/HAP-848 As a temporary workaround, you can add your JDK/bin directory to the PATH environment variable on the Jenkins build agent. 请参见跟踪此任务的问题: https : //www.jfrog.com/jira/browse/HAP-848作为临时解决方法,您可以将JDK / bin目录添加到Jenkins构建代理上的PATH环境变量中。 You need to add it directly on the agent machine (not through Jenkine). 您需要将其直接添加到代理计算机上(而不是通过Jenkine)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM