简体   繁体   English

传递内部版本号时出错 - Azure devops gradle 任务

[英]Error passing build number - Azure devops gradle task

I am trying to execute the below task in Azure devops :我正在尝试在Azure devops中执行以下任务:

- task: Gradle@3
displayName: 'Build Task'
continueOnError: false
inputs:
  tasks: assembledevelopDebug -PversionCode=$(Build.BuildNumber) -PdisablePreDex --no-daemon
  publishJUnitResults: false

I get the below error.我收到以下错误。 Can someone please tell if there is anything wrong the way in which I am passing the build number -PversionCode=$(Build.BuildNumber) .有人可以告诉我传递内部版本号的方式是否有任何问题-PversionCode=$(Build.BuildNumber)

FAILURE: Build failed with an exception.

* Where:
Build file '/Users/runner/work/1/s/app/build.gradle' line: 15

* What went wrong:
A problem occurred evaluating project ':app'.
> For input string: "20220804.6"

Error: The process '/Users/runner/work/1/s/gradlew' failed with exit code 1
* Try:
    at ExecState._setResult (/Users/runner/work/_tasks/Gradle_8d8eebd8-2b94-4c97-85af-839254cc6da4/3.205.0/node_modules/azure-pipelines-task-lib/toolrunner.js:944:25)
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
    at ExecState.CheckComplete (/Users/runner/work/_tasks/Gradle_8d8eebd8-2b94-4c97-85af-839254cc6da4/3.205.0/node_modules/azure-pipelines-task-lib/toolrunner.js:927:18)

    at ChildProcess.<anonymous> (/Users/runner/work/_tasks/Gradle_8d8eebd8-2b94-4c97-85af-839254cc6da4/3.205.0/node_modules/azure-pipelines-task-lib/toolrunner.js:840:19)
* Get more help at https://help.gradle.org
    at ChildProcess.emit (events.js:198:13)

    at maybeClose (internal/child_process.js:982:16)
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
    at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.5/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 23s
##[error]Code analysis failed. Gradle exit code: -1. Error: Error: The process '/Users/runner/work/1/s/gradlew' failed with exit code 1
Finishing: Build Task

Please note, this is how I do the same in gitlab pipeline and it works without issues assembledevelopDebug -PversionCode=%CI_BUILD_ID% -PdisablePreDex --no-daemon请注意,这就是我在 gitlab 管道中执行相同操作的方式,并且它可以正常工作assembledevelopDebug -PversionCode=%CI_BUILD_ID% -PdisablePreDex --no-daemon

I figured this out;我想通了; I can pass only Integer value for PversionCode.我只能为 PversionCode 传递 Integer 值。 Changing $(Build.BuildNumber) to $(Build.BuildId) will give an incremental unique Integer and resolves the error.将 $(Build.BuildNumber) 更改为 $(Build.BuildId) 将提供增量唯一 Integer 并解决错误。

暂无
暂无

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

相关问题 Azure DevOps gradle 构建失败 - Azure DevOps gradle build fails Cordova:为任务&#39;:transformClassesWithMultidexlistForDebug&#39;构建错误信息 - Cordova : Build error gradle for task ':transformClassesWithMultidexlistForDebug' Microsoft Azure DevOps 管道失败并在 Gradle Android 中出现连接重置错误 - Microsoft Azure DevOps Pipeline failing with Connection Reset error in Gradle Android Gradle Build Error - 在app:compileDebugJava gradle任务期间抛出NullPointerException - Gradle Build Error - NullPointerException thrown during app:compileDebugJava gradle task Azure DevOps iOS 和 Android React Native 构建在 Pod 安装和 Gradle 构建步骤上失败 - Azure DevOps iOS and Android React Native Build Failing on Pod Install and Gradle Build Steps gradle构建中没有测试任务 - no test task in gradle build Gradle 构建错误,错误:任务 &#39;:app:transformResourcesWithMergeJavaResForDebug&#39; 的执行失败 - Gradle build error, Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug' Android Azure Devops Gradle 在使用 zipalign 签名 apk 时构建失败,退出代码 1 - Android Azure Devops Gradle build failing on signing apk w zipalign, exit code 1 Gradle 3.0构建错误:任务执行失败&#39;:app:transformClassesWithDesugarForDebug&#39; - Gradle 3.0 Build Error : Execution failed for task ':app:transformClassesWithDesugarForDebug' gradle build Error:任务&#39;:core-app:dexDebug&#39;的执行失败 - gradle build Error:Execution failed for task ':core-app:dexDebug'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM