[英]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.