Corda模板Kotlin Gradle子项目

时间:2018-08-16 09:39:55

标签: corda

我正在尝试将cordapp-template-kotlin放置在gradle子项目中。

rootProject
  - ProjectA
  - ProjectB
    - app
      - cordapp
      - cordapp-contracts-states

应用是模板。

我得到的第一个错误是:

Cannot get property 'quasar_version' on extra properties extension as it does not exist

将其移至root build.gradle即可解决此问题

ext {
  quasar_version = '0.7.9'
}

但是当我尝试运行deployNodes时,出现以下错误:

> Collection contains no element matching the predicate.

我想念什么?

编辑:

deployNodes不变:

task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) {
  directory "./build/nodes"
  node {
    name "O=Notary,L=London,C=GB"
    notary = [validating : false]
    p2pPort 10002
    rpcSettings {
        address("localhost:10003")
        adminAddress("localhost:10043")
    }
    cordapps = [
            "$project.group:cordapp-contracts-states:$project.version",
            "$project.group:cordapp:$project.version",
            "$corda_release_group:corda-finance:$corda_release_version"
    ]
  }
  node {
    name "O=PartyA,L=London,C=GB"
    p2pPort 10005
    rpcSettings {
        address("localhost:10006")
        adminAddress("localhost:10046")
    }
    webPort 10007
    cordapps = [
            "$project.group:cordapp-contracts-states:$project.version",
            "$project.group:cordapp:$project.version",
            "$corda_release_group:corda-finance:$corda_release_version"
    ]
    rpcUsers = [[ user: "user1", "password": "test", "permissions": ["ALL"]]]
 }
 node {
    name "O=PartyB,L=New York,C=US"
    p2pPort 10008
    rpcSettings {
        address("localhost:10009")
        adminAddress("localhost:10049")
    }
    webPort 10010
    cordapps = [
            "$project.group:cordapp-contracts-states:$project.version",
            "$project.group:cordapp:$project.version",
            "$corda_release_group:corda-finance:$corda_release_version"
    ]
    rpcUsers = [[ user: "user1", "password": "test", "permissions": ["ALL"]]]
  }
}

输出:

09:37:40.507 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Execution failed for task ':app:deployNodes'.
09:37:40.507 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > Collection contains no element matching the predicate.
09:37:40.507 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 
09:37:40.507 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * Try:
09:37:40.507 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]  Run with --scan to get full insights.
09:37:40.508 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 
09:37:40.508 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * Exception is:
09:37:40.509 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:deployNodes'.
09:37:40.509 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:110)
09:37:40.509 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:77)
09:37:40.509 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51)
09:37:40.509 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:59)
09:37:40.510 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
09:37:40.510 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:59)
09:37:40.510 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:101)
09:37:40.510 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.tasks.execution.FinalizeInputFilePropertiesTaskExecuter.execute(FinalizeInputFilePropertiesTaskExecuter.java:44)
09:37:40.510 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:91)
09:37:40.510 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:62)
09:37:40.510 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:59)
09:37:40.510 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
09:37:40.511 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
09:37:40.511 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
09:37:40.511 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.run(EventFiringTaskExecuter.java:51)
09:37:40.511 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:317)
09:37:40.511 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:309)
09:37:40.511 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:185)
09:37:40.511 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:97)
09:37:40.512 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
09:37:40.512 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:46)
09:37:40.512 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$ExecuteTaskAction.execute(DefaultTaskExecutionGraph.java:262)
09:37:40.512 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$ExecuteTaskAction.execute(DefaultTaskExecutionGraph.java:246)
09:37:40.512 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:136)
09:37:40.512 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:130)
09:37:40.512 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.execute(DefaultTaskPlanExecutor.java:201)
09:37:40.512 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.executeWithTask(DefaultTaskPlanExecutor.java:192)
09:37:40.512 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:130)
09:37:40.513 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
09:37:40.513 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
09:37:40.513 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
09:37:40.513 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Caused by: java.util.NoSuchElementException: Collection contains no element matching the predicate.
09:37:40.513 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at net.corda.plugins.Cordformation$Companion.getPluginFile(Cordformation.kt:77)
09:37:40.513 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at net.corda.plugins.Cordform$installRunScript$1.execute(Cordform.kt:29)
09:37:40.513 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at net.corda.plugins.Cordform$installRunScript$1.execute(Cordform.kt:17)
09:37:40.513 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.file.copy.FileCopier.createCopySpec(FileCopier.java:45)
09:37:40.514 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.file.copy.FileCopier.copy(FileCopier.java:50)
09:37:40.514 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.file.DefaultFileOperations.copy(DefaultFileOperations.java:167)
09:37:40.514 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.project.DefaultProject.copy(DefaultProject.java:1051)
09:37:40.514 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at net.corda.plugins.Cordform.installRunScript(Cordform.kt:27)
09:37:40.514 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at net.corda.plugins.Cordform.build(Cordform.kt:62)
09:37:40.514 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
09:37:40.514 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.project.taskfactory.StandardTaskAction.doExecute(StandardTaskAction.java:46)
09:37:40.514 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:39)
09:37:40.514 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:26)
09:37:40.514 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:794)
09:37:40.515 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:761)
09:37:40.515 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:131)
09:37:40.515 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:317)
09:37:40.515 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:309)
09:37:40.515 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:185)
09:37:40.515 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:97)
09:37:40.515 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
09:37:40.515 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:120)
09:37:40.516 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:99)
09:37:40.516 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   ... 30 more

1 个答案:

答案 0 :(得分:0)

您需要在构建脚本中添加cordformation作为依赖项。您更新的构建脚本可能如下所示:

buildscript {
    ext {
        quasar_version = '0.7.9'
        corda_release_version = '3.2-corda'
        corda_gradle_plugins_version = '3.1.0'
    }

    repositories {
        mavenCentral()
    }

    dependencies {
        classpath "net.corda.plugins:cordformation:$corda_gradle_plugins_version"
    }
}