我有一个可工作的Corda Gradle版本。我们的deploy1Node
任务可以通过IntelliJ,Windows中的cmd和MacOS中的iTerm正常运行。
对于此特定版本,我们正在使用 corda-3.2开源(net.corda:corda-3.2:...
)。
3.3开源也会出现此问题,并且
ubuntu上的Oracle Java版本“ 1.8.0_171”,mac上的Oracle Java版本“ 1.8.0_152”。
当我尝试在Linux系统中执行它时,出现以下错误
Caused by: java.lang.ClassCastException: sun.nio.fs.UnixPath cannot be cast to java.lang.String
,如下面的堆栈跟踪摘录所示:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':deploy1Node'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:100)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:70)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:63)
...
...
Caused by: java.lang.ClassCastException: sun.nio.fs.UnixPath cannot be cast to java.lang.String
at net.corda.nodeapi.internal.network.NetworkBootstrapper.generateWhitelist(NetworkBootstrapper.kt:323)
at net.corda.nodeapi.internal.network.NetworkBootstrapper.bootstrap(NetworkBootstrapper.kt:85)
at net.corda.plugins.Baseform.bootstrapNetwork(Baseform.kt:160)
at net.corda.plugins.Cordform.build(Cordform.kt:66)
...
...
无论平台如何,该任务如何工作?
开源jar版本是:
Corda-Revision: 5ae8325980ad22df8146b983afeaca344fc03c3e
Corda-Vendor: Corda Open Source
Corda-Release-Version: 3.2-corda
企业版似乎还可以:
Corda-Revision: c9b23a4400923a5cfe88271ce2fedd75740eac40
Corda-Vendor: Corda Enterprise Edition
Corda-Release-Version: 3.1
尝试找出此问题,我发现在企业版中 它显示在gradle构建中:
> Task :deploy1Node
Putting task artifact state for task ':deploy1Node' into context took 0.0 secs.
Executing task ':deploy1Node' (up-to-date check took 0.0 secs) due to:
Task has not declared any outputs.
Running Cordform task
Deleting ./build/nodes
Bootstrapping local test network in /mnt/builds/Cordapp/appname/build/nodes
Generating node directory for Node
Copying CorDapp JARs into node directories
,在开源版本中,输出为:
> Task :deploy1Node
Putting task artifact state for task ':deploy1Node' into context took 0.0 secs.
Executing task ':deploy1Node' (up-to-date check took 0.0 secs) due to:
Task has not declared any outputs.
Running Cordform task
Deleting ./build/nodes
Bootstrapping local network in /mnt/builds/Cordapp/appname/build/nodes
Node config files found in the root directory - generating node directories
Generating directory for Node_node
Nodes found in the following sub-directories: [Node_node]
似乎将_node
附加在不应附加的位置。
这个问题的另一个参考在一个俄语站点中: http://qaru.site/questions/16922067/why-does-my-deploy1node-task-fails-complaining-about-javalangclasscastexception-sunniofsunixpath-cannot-be-cast-to-javalangstring
答案 0 :(得分:0)
为防止出现此问题,请确保您的ext.corda_release_group
,ext.corda_release_version
和ext.corda_gradle_plugins_version
在您的任何buildscript
会话中定义一次一次和一次
项目恰好有。
该问题是由于尝试让build.gradle
在
2种不同的Corda发行版(开源和企业版)-并在首次使用后更改 default 选项。对于open source
,build.gradle
的{{1}}部分必须具有以下设置:
buildscript
同样,对于企业版,设置必须类似于:
buildscript {
...
ext.corda_release_group = 'net.corda'
ext.corda_release_version = '3.2-corda'
ext.corda_gradle_plugins_version = '3.0.9'
ext.kotlin_version = '1.2.50'
...
一旦选择,引用就会纠缠在一起,并且buildscript {
...
ext.corda_release_group = 'com.r3.corda'
ext.corda_release_version = '3.1'
ext.corda_gradle_plugins_version = '4.0.25'
ext.kotlin_version = '1.2.50'
...
任务在开源版本中失败。
一种可能性是使用类似的东西:
deploy1Node