gpt4 book ai didi

jenkins - Kotlin在本地计算机上正确编译了项目,但是通过Jenkins抛出异常

转载 作者:行者123 更新时间:2023-12-02 13:36:28 25 4
gpt4 key购买 nike

我有一个库,其中有一个伴随对象值,如下所示

companion object {
const val QUEUE_CLUSTER_ID = "Commands"
}

我项目的一个类依赖于此库,使用lib的QUEUE_CLUSTER_ID val,如下所示
data class CreateCatalogItemCommand(
@JsonProperty("styleVariant") val styleVariant: StyleVariant?) : Commandable() {

companion object {
const val QUEUE_ID = QUEUE_CLUSTER_ID.plus("CreateCatalogItemCommand")
}
}

问题是kotlin在我的机器上正确编译了项目,但是通过jenkins我得到了以下错误。当QUEUE_ID设置为普通字符串时,错误消失。
[INFO] --- kotlin-maven-plugin:1.3.21:compile (compile) @ catalog- 
service ---
[INFO] Applied plugin: 'spring'
[ERROR] /var/lib/jenkins/workspace/Catalog-Service/src/main/kotlin/com/mg/catalog/command/CreateCatalogItemCommand.kt: (11, 31) Unresolved reference: QUEUE_CLUSTER_ID
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 8.864s
[INFO] Finished at: Fri Mar 29 08:40:37 UTC 2019
[INFO] Final Memory: 74M/713M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.jetbrains.kotlin:kotlin-maven-
plugin:1.3.21:compile (compile) on project catalog-service: Compilation
failure
[ERROR] /var/lib/jenkins/workspace/Catalog-Service/src/main/kotlin/com/mg/catalog/command/CreateCatalogItemCommand.kt:
[11,31] Unresolved reference: QUEUE_CLUSTER_ID
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to
execute goal org.jetbrains.kotlin:kotlin-maven-plugin:1.3.21:compile
(compile) on project catalog-service: Compilation failure
/var/lib/jenkins/workspace/Catalog-Service/src/main/kotlin/com/mg/catalog/command/CreateCatalogItemCommand.kt:[11,31] Unresolved reference: QUEUE_CLUSTER_ID

最佳答案

似乎该异常与kotlin类型推断有关。在我指出类型之后,特别编译已经完成,没有错误。但为什么?仍然不了解我的机器如何使用类型推断进行编译?

companion object {
const val QUEUE_CLUSTER_ID: String = "Commands"
}

关于jenkins - Kotlin在本地计算机上正确编译了项目,但是通过Jenkins抛出异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55413602/

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