dubbo jar 配置文件

Posted World_maker

tags:

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

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>wusc.edu.pay.common</groupId>
        <artifactId>pay-common-parent</artifactId>
        <version>1.0-SNAPSHOT</version>
        <relativePath>../pay-common-parent</relativePath>
    </parent>

    <groupId>wusc.edu.pay.service</groupId>
    <artifactId>pay-service-cost</artifactId>
    <packaging>jar</packaging>
    <version>${pay-service-cost.version}</version>

    <name>pay-service-cost</name>
    <url>http://maven.apache.org</url>
    
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <log4j.leve>debug</log4j.leve>
        <log4j.ale>debug</log4j.ale>
    </properties>

    <build>
        <finalName>pay-service-cost</finalName>
        <resources>
            <resource>
                <targetPath>${project.build.directory}/classes</targetPath>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
                <includes>
                    <include>**/*.xml</include>
                    <include>**/*.properties</include>
                </includes>
            </resource>
            <resource>
                <targetPath>${project.build.directory}/classes/META-INF/spring</targetPath>
                <directory>src/main/resources/spring</directory>
                <filtering>true</filtering>
                <includes>
                    <include>spring-context.xml</include>
                </includes>
            </resource>
        </resources>
        <pluginManagement>
            <plugins>
                <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>
            <!-- 打包jar文件时,配置manifest文件,加入lib包的jar依赖 -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                    <classesDirectory>target/classes/</classesDirectory>
                    <archive>
                        <manifest>
                            <mainClass>com.alibaba.dubbo.container.Main</mainClass>
                            <!-- 打包时 MANIFEST.MF文件不记录的时间戳版本 -->
                            <useUniqueVersions>false</useUniqueVersions>
                            <addClasspath>true</addClasspath>
                            <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>
                            <outputDirectory>
                                ${project.build.directory}/lib
                            </outputDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <dependencies>
        <dependency>
            <groupId>wusc.edu.pay.common</groupId>
            <artifactId>pay-common</artifactId>
            <version>${pay-common.version}</version>
        </dependency>
        <dependency>
            <groupId>wusc.edu.pay.common</groupId>
            <artifactId>pay-common-config</artifactId>
            <version>${env}-${pay-common-config.version}</version>
        </dependency>
        <dependency>
            <groupId>wusc.edu.pay.common</groupId>
            <artifactId>pay-common-core</artifactId>
            <version>${pay-common-core.version}</version>
        </dependency>

        <dependency>
            <groupId>wusc.edu.pay.facade</groupId>
            <artifactId>pay-facade-cost</artifactId>
            <version>${pay-facade-cost.version}</version>
        </dependency>

        <!-- Spring Dependency Begin -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-test</artifactId>
            <scope>test</scope>
        </dependency>
        <!-- Spring Dependency End -->

        <!-- dubbo required jars start -->
        <dependency>
            <groupId>org.jboss.netty</groupId>
            <artifactId>netty</artifactId>
        </dependency>
        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>dubbo</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework</groupId>
                    <artifactId>spring</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.apache.zookeeper</groupId>
            <artifactId>zookeeper</artifactId>
        </dependency>
        <dependency>
            <groupId>com.101tec</groupId>
            <artifactId>zkclient</artifactId>
        </dependency>
        <!-- dubbo required jars end -->

        <!-- 多线程测试工具 Begin -->
        <dependency>
            <groupId>fakepath</groupId>
            <artifactId>groboutils-core</artifactId>
            <version>5</version>
            <scope>test</scope>
        </dependency>
        <!-- 多线程测试工具 End -->
    </dependencies>
</project>

 

以上是关于dubbo jar 配置文件的主要内容,如果未能解决你的问题,请参考以下文章

Gradle 引入本地定制 jar 包

springboot2.0+dubbo-spring-boot-starter聚合项目打可执行的jar包

Dubbo监控中心

Dubbo面试

dubbo源码分析7——dubbo的配置解析_与spring的整合

Dubbo源码分析系列---扩展点加载