您的位置:首页 > 其它

dubbo测试搭建 --- 使用maven设计模块(二)

2016-08-20 11:20 519 查看
代码示例访问我的github:https://github.com/WilsonZhang8/dubbo-demo

初步试用dubbo,首先使用maven设计了各个模块之间的继承关系。

dubbo-parent是父模块,仅仅提供公共的配置,消除重复配置。

dubbo-simple-entity是实体类,常用的po vo 持久化实体等。

dubbo-simple-service-api提供了dao和service对应的api接口。(生产者接口定义)

dubbo-simple-service-impl提供了dao和service对应api的接口实现。(生产者实现(或消费者使用),dubbo对应的生产者)

dubbo-config提供了dubbo-simple-service-api和dubbo-simple-service-impl的配置。

dubbo-simple-webapp一般作为控制转发,是Controller层的实现。(一般作为消费者,调用dubbo提供的服务)。



创建dubbo-parent模块

由于父模块只是为了帮助消除配置的重复,因此它本身不包含除pom之外的项目文件,也就不需要src/main/java/之类的文件夹了。


pom.xml文件中报下面的错误则代表:不要使用eclipse中自带的maven,要配置自己的maven及setting文件。

Description Resource Path Location Type CoreException: Could not calculate build plan: Plugin org.apache.maven.plugins:maven-compiler-plugin:3.1 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-compiler-plugin:jar:3.1:
ArtifactResolutionException: Failure to transfer org.apache.maven.plugins:maven-compiler-plugin:pom:3.1 fromhttps://repo.maven.apache.org/maven2 was cached in the local
repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.apache.maven.plugins:maven-compiler-plugin:pom:3.1 from/to central (https://repo.maven.apache.org/maven2): repo.maven.apache.org
pom.xml /dubbo-simple line 1 Maven Project Build Lifecycle Mapping Problem

1.创建实体模块dubbo-simple-entity继承于父模块dubbo-parent.

该模块主要是包含了po jo vo 等各种新的实体对象或者包含了持久化对象。



2.创建服务接口API模块dubbo-simple-service-api继承于父模块dubbo-parent.



3.创建服务接口API实现模块dubbo-simple-service-impl继承于父模块dubbo-parent.



4.接口api和接口实现模块对应的配置模块 dubbo-config



5.创建web控制器模块dubbo-simple-webapp继承于父模块dubbo-parent.

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: