无法使用IntelliJ IDEA导入sumCashBy [英] Unable to import sumCashBy using IntelliJ IDEA

查看:67
本文介绍了无法使用IntelliJ IDEA导入sumCashBy的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

IntelliJ IDEA开始在我之前使用的某些导入语句中突出显示错误.这并不奇怪,因为net.corda.finance仍处于孵化"阶段.

IntelliJ IDEA started highlighting errors in some of my import statements that worked previously. This is not unexpected as net.corda.finance is still in the "incubating" stage.

我正在使用Java.

Corda版本:3.3

Corda Release: 3.3

在github上注意到了此更改: https://github.com/corda/corda/pull/4700

Noticed this change on github: https://github.com/corda/corda/pull/4700

所以我做了我认为是必要的更改...

So I made what I thought are the necessary changes...

//旧

///导入静态net.corda.finance.utils.StateSumming.sumCashBy;

//import static net.corda.finance.utils.StateSumming.sumCashBy;

//新

导入静态net.corda.finance.contracts.utils.StateSumming.sumCashBy;

import static net.corda.finance.contracts.utils.StateSumming.sumCashBy;

...但是我仍然遇到错误.我相信我一定会忽略一些简单的事情.

...but I'm still getting an error. I am sure I must be overlooking something simple.

推荐答案

@ Kid101通过尝试StateSumming.sumCashBy(contractState)

@Kid101 put me on the right track by trying StateSumming.sumCashBy(contractState)

一旦我做了IntelliJ识别,就需要添加:

Once I did that IntelliJ recognized I needed to add:

net.corda:corda-finance:3.3-corda 

...到类路径.如果我允许IntelliJ从上下文菜单中添加它,则每当gradle刷新时,该错误就会再次出现.所以我加了:

...to the classpath. If I allowed IntelliJ to add it from the context menu the error reappeared every time gradle refreshed. So I added:

cordaCompile "$corda_release_group:corda-finance:$corda_release_version"

...到依赖项"部分下的build.gradle文件.我的导入语句没有更多错误:

...to the build.gradle file under the dependencies section. No more errors with my import statement:

import net.corda.finance.utils.StateSumming;

...并且调用sumCashBy方法没有问题.

...and no issues calling the sumCashBy method.

这篇关于无法使用IntelliJ IDEA导入sumCashBy的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆