dubbo服务达成jar包

Posted 王德冲

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了dubbo服务达成jar包相关的知识,希望对你有一定的参考价值。

<build>
<finalName>dubbo-provider</finalName> <!-- jar包名,一般设置为提供者服务名 -->

<resources>
<!-- 把resource目录下所有文件和文件夹导入到jar包内 -->
<resource>
<targetPath>${project.build.directory}/classes</targetPath>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes>
<!-- 可直接写为<include>**/*</include>包含所有文件 -->
<include>**/*.xml</include>
<include>**/*.properties</include>
</includes>
</resource>
<!-- 使用com.alibaba.dubbo.container.Main启动spring容器,会默认加载META-INF/spring目录下的所有spring配置 -->
<resource>
<targetPath>${project.build.directory}/classes/META-INF/spring</targetPath>
<directory>src/main/resources/spring</directory>
<filtering>true</filtering>
<!-- 把src/main/resources/spring路径下的spring配置文件拷贝到${project.build.directory}/classes/META-INF/spring下 -->
<includes>
<include>spring-application.xml</include>
</includes>
</resource>
</resources>

<pluginManagement>
<plugins>
<!-- 解决Maven插件在Eclipse内执行了一系列的生命周期引起冲突 -->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<versionRange>[2.0,)</versionRange>
<goals>
<goal>copy-dependencies</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore />
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<!-- maven打包成jar的插件 -->
<!-- 打包jar文件时,配置manifest文件,加入lib包的jar依赖 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<!-- 把target/classes/下的文件导入到jar内 -->
<classesDirectory>target/classes/</classesDirectory>
<archive>
<manifest>
<!-- 指定程序入口 -->
<mainClass>com.alibaba.dubbo.container.Main</mainClass>
<!-- 打包时 MANIFEST.MF文件不记录的时间戳版本 -->
<useUniqueVersions>false</useUniqueVersions>
<addClasspath>true</addClasspath>
<!-- 服务依赖的jar包放在lib目录下 -->
<classpathPrefix>lib/</classpathPrefix>
</manifest>
<manifestEntries>
<Class-Path>.</Class-Path>
</manifestEntries>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<type>jar</type>
<includeTypes>jar</includeTypes>
<!-- 存放服务依赖的jar包,存放在服务相同目录的lib文件夹下 -->
<outputDirectory>
${project.build.directory}/lib
</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>




































































































以上是关于dubbo服务达成jar包的主要内容,如果未能解决你的问题,请参考以下文章

短信平台README.MD

学习dubbo:部署dubbo服务

Dubbo配置参数详解-generic

微服务测试之使用Jmeter插件jmeter_dubbo_plugin测试dubbo接口

关于动态注册dubbo的思路,做法

Dubbo面试