导入示例Corda项目时出现Gradle错误

时间:2018-06-22 12:02:32

标签: corda

我正在尝试遵循Github上的文档和示例代码

但是,正如文档中所述,我无法在IntelliJ中导入项目。我尝试使用Open项目以及导入Gradle项目,但是在每一行都失败了。我尝试从示例代码修改gradle文件,并在顶部添加了buildscript

buildscript {
    ext.kotlin_version = '1.1.60'
    ext.junit_version = '4.12'
    ext.quasar_version = '0.7.9'
    ext.corda_release_group = 'net.corda'
    ext.corda_release_version = '3.1-corda'
    ext.corda_gradle_plugins_version = '3.1.0'
    ext.junit_version = '4.12'
    ext.quasar_version = '0.7.9'

    repositories {
        mavenLocal()
        mavenCentral()
        jcenter()
    }

    dependencies {
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath "net.corda.plugins:cordapp:$corda_gradle_plugins_version"
        classpath "net.corda.plugins:cordformation:$corda_gradle_plugins_version"
        classpath "net.corda.plugins:quasar-utils:$corda_gradle_plugins_version"
        classpath "net.corda.plugins:publish-utils:$corda_gradle_plugins_version"
    }
}

repositories {
    mavenLocal()
    jcenter()
    mavenCentral()
    maven { url 'https://jitpack.io' }
    maven { url 'https://ci-artifactory.corda.r3cev.com/artifactory/corda-releases' }
}

//import net.corda.plugins.Cordform

apply plugin: 'java'
//apply plugin: 'kotlin'
apply plugin: 'idea'
apply plugin: 'net.corda.plugins.quasar-utils'
apply plugin: 'net.corda.plugins.publish-utils'
apply plugin: 'net.corda.plugins.cordapp'
apply plugin: 'net.corda.plugins.cordformation'
apply plugin: 'maven-publish'

configurations {
    integrationTestCompile.extendsFrom testCompile
    integrationTestRuntime.extendsFrom testRuntime
}

dependencies {
    compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
    testCompile "junit:junit:$junit_version"

    // Corda integration dependencies
    cordaCompile project(":node")
    cordaCompile project(path: ":node:capsule", configuration: 'runtimeArtifacts')
    cordaCompile project(path: ":webserver:webcapsule", configuration: 'runtimeArtifacts')
    cordaCompile project(':core')
    cordaCompile project(':client:jfx')
    cordaCompile project(':client:rpc')
    cordaCompile project(':node-driver')
}

idea {
    module {
        downloadJavadoc = true // defaults to false
        downloadSources = true
    }
}

publishing {
    publications {
        jarAndSources(MavenPublication) {
            from components.java
            artifactId 'notarydemo'

            artifact sourceJar
            artifact javadocJar
        }
    }
}

task deployNodes(dependsOn: ['deployNodesSingle', 'deployNodesRaft', 'deployNodesBFT', 'deployNodesCustom'])

task deployNodesSingle(type: Cordform, dependsOn: 'jar') {
    definitionClass = 'net.corda.notarydemo.SingleNotaryCordform'
}

task deployNodesCustom(type: Cordform, dependsOn: 'jar') {
    definitionClass = 'net.corda.notarydemo.CustomNotaryCordform'
}

task deployNodesRaft(type: Cordform, dependsOn: 'jar') {
    definitionClass = 'net.corda.notarydemo.RaftNotaryCordform'
}

task deployNodesBFT(type: Cordform, dependsOn: 'jar') {
    definitionClass = 'net.corda.notarydemo.BFTNotaryCordform'
}

task notarise(type: JavaExec) {
    classpath = sourceSets.main.runtimeClasspath
    main = 'net.corda.notarydemo.NotariseKt'
}

jar {
    manifest {
        attributes(
                'Automatic-Module-Name': 'net.corda.samples.demos.notary'
        )
    }
}

但是,应用插件kotlin,导入Cordform和编译项目仍然失败。请指导如何使用这些示例项目并运行它们。

谢谢

1 个答案:

答案 0 :(得分:0)

您需要直接导入整个Corda项目,而不是直接打开/导入notary-demo示例文件夹。