gpt4 book ai didi

jenkins - 运行Artifactory Jenkins插件时不要 'artifactoryPublish'

转载 作者:行者123 更新时间:2023-12-03 04:48:31 25 4
gpt4 key购买 nike

是否可以在不运行gradle.run任务的情况下执行artifactoryPublish(请参见下文)?我以为可以通过指定task参数来完成此任务,但是插件似乎可以重新添加任务。例如,以下内容:

def server = Artifactory.server('artifactory-primary')
def gradle = Artifactory.newGradleBuild()
gradle.resolver server: server, repo: 'gradle-all-virtual'
gradle.deployer server: server, repo: 'gradle-libs-snapshot-local'
gradle.deployer.mavenCompatible = true
gradle.useWrapper = true
gradle.usesPlugin = true

def buildInfo = gradle.run(
rootDir: ".",
buildFile: 'build.gradle',
tasks: 'build',
switches: '--no-daemon -x check')
server.publishBuildInfo buildInfo

结果是:
...
gradlew -x check build artifactoryPublish -b build.gradle
...

当我真正想要的是:
...
gradlew -x check build -b build.gradle
...

最终,我想在一个阶段中进行构建,并在另一个阶段中进行部署。

相同的代码段,但从Gradle文件中删除了对人工制品的引用,并在以下文件中添加了Tamir的附加内容:
def server = Artifactory.server('artifactory-primary')
def gradle = Artifactory.newGradleBuild()
gradle.resolver server: server, repo: 'gradle-all-virtual'
gradle.deployer server: server, repo: 'gradle-libs-snapshot-local'
gradle.deployer.mavenCompatible = true
gradle.deployer.deployArtifacts = false
gradle.useWrapper = true
gradle.usesPlugin = false

def buildInfo = gradle.run(
rootDir: ".",
buildFile: 'build.gradle',
tasks: 'build',
switches: '--no-daemon -x check')
server.publishBuildInfo buildInfo

产生相同的结果。

最佳答案

默认情况下添加了artifactoryPublish任务,您可以在Jenkins Artifactory plugin code中看到它。
如果您不希望将 Artifact 部署到 Artifact ,则可以通过配置deployer.deployArtifacts = false来实现。
在您的情况下:

gradle.deployer.deployArtifacts = false

如果要分两个阶段构建项目,则可以一次使用deployArtifacts = false进行构建,而第二次使用deployArtifacts = true进行构建

关于jenkins - 运行Artifactory Jenkins插件时不要 'artifactoryPublish',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42106663/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com