fabric-sdk-java源码maven项目环境搭建

来源:互联网 发布:emlog源码下载 编辑:程序博客网 时间:2024/06/06 01:28

1.通过git下载源码

https://github.com/hyperledger/fabric-sdk-java

2.解压并导入eclipse中

注意环境需要:jdk1.8,eclipse尽量使用最新版本

如果导入时,有弹框报错:Failed to read the project description file (.project) for 'fabric-sdk-java-master'.  The file has been changed on disk, and it now contains invalid information.  The project will not function properly until the description file is restored to a valid state.

把解压后的项目文件中的.project文件删除即可。

3.maven update后的第一个POM错误com.google.protobuf:protoc:exe:${os.detected.classifier}:3.0.0

解决方式:

随便在一个java项目中写个main方法,输入如下代码

System.out.println(System.getProperty("os.name"));System.out.println(System.getProperty("os.arch"));

查看返回值,如返回Windows 7    amd64  需要被转换为:windows-x86_64

在pom的properties中增加<os.detected.classifier>windows-x86_64</os.detected.classifier>即可

其他返回值在https://github.com/trustin/os-maven-plugin这个链接中找对应的值做转换后写在<os.detected.classifier>的对应参数中。

4.第二个POM错误plugins部分标签错误

解决办法:在plugins上使用<pluginManagement>标签将其包起来

5.第三个项目的类中部分Grpc后缀的类找不到

解决办法:在POM.XML文件中引入,本身项目的jar包依赖即可

<dependency><groupId>org.hyperledger.fabric-sdk-java</groupId><artifactId>fabric-sdk-java</artifactId><version>1.0.1</version></dependency>
导入这个有可能在项目的maven dependencies中加载不进来fabric-sdk-java的jar包,从而导致项目中的类import不了jar包中的类,这是因为项目的POM文件的groupId与你引入的依赖的groupId一致了,此时把项目的groupId改个其它名字即可。


原创粉丝点击