小编DO *_* IT的帖子

如何使用Gradle推送到Github软件包注册表

试图将Gradle项目推送到Github程序包注册表,但是没有按预期工作。

使用io.freefair.github.package-registry-maven-publishGradle插件。

在GitHub中配置build.gradle发布所需的数据-以下代码。并运行发布任务publishAllPublicationsToGutHub。没有得到任何错误,但是我在GitHub软件包注册表中看不到我的软件包。

github {
    slug
    username = "myGitUserName"
    token = "myTokenWithRightAccess"
    tag = "HEAD"
    travis = true
}
Run Code Online (Sandbox Code Playgroud)

期待一些如何使用Gradle发布到Github软件包注册表的示例,或者发布时我做错了什么

java gradle maven github-package-registry

9
推荐指数
1
解决办法
1141
查看次数

如何使用 Mockito 用 lambda 模拟内联函数

使用 lambda 模拟内联函数时遇到问题。有课UserController,尝试tracer用函数来模拟createSpan

用户控制器类:

class UserController(private val tracer:Tracer) {
  fun subscribeUser() {
    tracer.createSpan("GraphDB: subscribedUser") {
       do something...
    }
  }
}
Run Code Online (Sandbox Code Playgroud)

createSpan内联函数:

inline fun <T> Tracer.createSpan(operationName: String, block: SpanContext.() -> T): T =
    buildSpan(operationName)
        .start()
        .useOn(this, block)
Run Code Online (Sandbox Code Playgroud)

尝试过:

 Mockito.`when`(mockTracer.createSpan<Any>(any(), any())).thenReturn(mockSpanContext)  
Run Code Online (Sandbox Code Playgroud)

回报org.mockito.exceptions.misusing.InvalidUseOfMatchersException

 Mockito.`when`(mockTracer.createSpan<SpanContext>("GraphDB: subscribedUser", any())).thenReturn(mockSpanContext)

Run Code Online (Sandbox Code Playgroud)

回报java.lang.NullPointerException

尝试了不同的方法,但仅返回org.mockito.exceptions.misusing.InvalidUseOfMatchersExceptionjava.lang.NullPointerException

我怎样才能用 lambda 模拟这个内联函数,或者只是忽略它,因为我不想测试这个函数?任何帮助表示赞赏。

junit unit-testing mockito kotlin mockito-kotlin

7
推荐指数
0
解决办法
1481
查看次数

找不到模块:无法解析“readline”

我遇到Module not found: Can't resolve 'readline'已安装的 NPM 包错误,并且该包似乎存在于 node_modules 文件夹中。错误的地方:

错误的地方

module "c:/Users/ts-lord/Desktop/server/cdr-ui/node_modules/athena-express/lib/index"
Could not find a declaration file for module 'athena-express'. 'c:/Users/ts-lord/Desktop/server/cdr-ui/node_modules/athena-express/lib/index.js' implicitly has an 'any' type.
  Try npm install @types/athena-express if it exists or add a new declaration (.d.ts) file containing declare module athena-express';ts(7016) 
Run Code Online (Sandbox Code Playgroud)

尝试导入并需要该模块,但仍然有相同的错误。使用“创建反应应用程序”来创建反应应用程序。也尝试了上面的一切。下面的代码尝试使用 Athena 查询 s3。

module "c:/Users/ts-lord/Desktop/server/cdr-ui/node_modules/athena-express/lib/index"
Could not find a declaration file for module 'athena-express'. 'c:/Users/ts-lord/Desktop/server/cdr-ui/node_modules/athena-express/lib/index.js' implicitly has an 'any' type.
  Try npm install @types/athena-express if it exists or add a new declaration …
Run Code Online (Sandbox Code Playgroud)

javascript node.js aws-sdk amazon-athena

5
推荐指数
1
解决办法
2万
查看次数