IntelliJ + Corda:错误:(6,30)Java:包net.corda.testing.core不存在

时间:2018-11-30 18:07:49

标签: intellij-idea kotlin corda

我是使用IntelliJ + Corda + Kotlin的新手。

我刚刚安装了IntelliJ IDEA,克隆了Corda Git存储库BootCamp(https://github.com/corda/bootcamp-cordapp),IntelliJ向我展示的第一件事是一些错误,声称我认为是Kotlin软件包和类。

这是一些错误消息:

错误:(6,30)java:包net.corda.testing.core不存在

错误:(12,37)java:找不到符号

...符号:类TestIdentity

...位置:类test.java.java_bootcamp.StateTests

package test.java.java_bootcamp;

import net.corda.core.contracts.ContractState;
import net.corda.core.identity.CordaX500Name;
import net.corda.core.identity.Party;
import net.corda.testing.core.TestIdentity;
import org.junit.Test;
import static org.junit.Assert.assertEquals;

public class StateTests {

    private final Party alice = new TestIdentity(new CordaX500Name("Alice", "", "GB")).getParty();
    private final Party bob = new TestIdentity(new CordaX500Name("Bob", "", "GB")).getParty();

    @Test
    public void tokenStateHasIssuerOwnerAndAmountParamsOfCorrectTypeInConstructor() {
        new TokenState(alice, bob, 1);
    }

    @Test
    public void tokenStateImplementsContractState() {
        assert(new TokenState(alice, bob, 1) instanceof ContractState);
    }
}

我做错了什么或想念什么?

顺便说一句,我使用的是Mac

1 个答案:

答案 0 :(得分:1)

经过4个小时的痛苦,我发现我需要添加两个JAR,从而解决了我的问题(目前)。

这些是他们,来自Maven存储库:

    <!-- https://mvnrepository.com/artifact/net.corda/corda-test-utils -->
    <dependency>
        <groupId>net.corda</groupId>
        <artifactId>corda-test-utils</artifactId>
        <version>3.3-corda</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/net.corda/corda-node-driver -->
    <dependency>
        <groupId>net.corda</groupId>
        <artifactId>corda-node-driver</artifactId>
        <version>3.3-corda</version>
    </dependency>