java Web分布式后台搭建(一) 构建maven项目

1. 待实现组件目录清单

  • 云平台(cloud-platform)
    • 公用bean组件(cloud-beans)
    • 公用util组件(cloud-utils)
    • 注册中心(cloud-discovery)
    • redis服务组件(redis-service)
    • mongo服务组件(mongo-service)
    • mysql服务组件(mysql-service)
    • 对外restful api组件(client-api)
    • 对内admin管理组件(admin-system)
    • 权限服务组件(authority-service)

2. cloud-platform项目pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.china.wang</groupId>
    <artifactId>cloud-platform</artifactId>
    <version>V1.0.1</version>
    <packaging>pom</packaging>
    <name>cloud-platform</name>
    <description>云平台</description>

    <!--云平台组件指定-->
    <modules>
        <module>cloud-beans</module>
        <module>cloud-utils</module>
        <module>cloud-discovery</module>
        <module>redis-service</module>
        <module>mongo-service</module>
        <module>client-api</module>
        <module>admin-system</module>
        <module>authority-service</module>
        <module>mysql-service</module>
    </modules>

    <!--云平台spring boot关联版本指定-->
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.5.8.RELEASE</version>
    </parent>

    <properties>
        <!--swagger版本指定-->
        <springfox-version>2.7.0</springfox-version>
    </properties>


    <!--云平台常用组件版本声明-->
    <dependencyManagement>
        <dependencies>
            <!--spring cloud 相关jar配置参考pom-->
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>Dalston.SR4</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>

            <!--spring cloud服务组件-->
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-starter-eureka-server</artifactId>
            </dependency>

            <!--spring cloud 安全组件-->
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-starter-security</artifactId>
            </dependency>

            <!--spring cloud外部应用组件-->
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-starter-feign</artifactId>
            </dependency>

            <!--swagger2组件-->
            <dependency>
                <groupId>io.springfox</groupId>
                <artifactId>springfox-swagger2</artifactId>
                <version>${springfox-version}</version>
            </dependency>
            <dependency>
                <groupId>io.springfox</groupId>
                <artifactId>springfox-swagger-ui</artifactId>
                <version>${springfox-version}</version>
            </dependency>

        </dependencies>

    </dependencyManagement>


    <build>
        <!--可继承,覆盖的插件配置声明-->
        <pluginManagement>
            <plugins>
                <!--java编译插件-->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <configuration>
                        <source>1.8</source>
                        <target>1.8</target>
                    </configuration>
                </plugin>

                <!--生成源码文件插件-->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-source-plugin</artifactId>
                    <version>2.1.1</version>
                    <executions>
                        <execution>
                            <id>attach-sources</id>
                            <phase>package</phase>
                            <goals>
                                <goal>jar-no-fork</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>

                <!--spring boot 打包插件-->
                <plugin>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-maven-plugin</artifactId>
                    <configuration>
                        <jvmArguments>-Dfile.encoding=UTF-8</jvmArguments>
                    </configuration>
                    <executions>
                        <execution>
                            <goals>
                                <goal>repackage</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>
</project>

猜你喜欢

转载自blog.csdn.net/u013062667/article/details/79567822