其他分享
首页 > 其他分享> > 搭建springcloudalibaba项目

搭建springcloudalibaba项目

作者:互联网

为什么会出现SpringCloudAlibaba

由于Springcloud的NetFlix项目的全套的服务进入了停止维护的模式,也就是Springcloud团队不会再向模块添加新功能,不在开发新的组件和功能了。

什么是SpringCloudAlibaba

Spring Cloud For Alibaba,它是由一些阿里巴巴的开源组件和云产品组成的,这个项目的目的就是为了让大家所熟知的Spring框架,其优秀的设计模式和抽象理念,以给阿里巴巴产品的java开发者带来使用Spring Boot和Spring Cloud的更多便利。

SpringCloudAlibaba能干嘛

SpringCloudAlibaba都有哪些组件

创建项目

创建父项目

  1. 创建一个空文件夹 springcloudalibaba-test(名字按照实际需求) 用来装子项目

  2. 新建 maven项目 my-dependencies 用于父工程配置pom包信息

<?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.zl</groupId>
    <artifactId>my-dependencies</artifactId>
    <packaging>pom</packaging>
    <version>0.0.1-SNAPSHOT</version>

    <name>dependencies</name>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.1.4.RELEASE</version>
    </parent>

    <properties>
        <!-- Environment Settings -->
        <java.version>1.8</java.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

        <!-- DB Setting -->
        <freemarker.version>2.3.28</freemarker.version>
        <mybatis.plus.version>3.3.1</mybatis.plus.version>
        <druid.version>1.1.21</druid.version>
        <pgsql.version>9.4.1212</pgsql.version>
        <ojdbc.version>19.3.0.0</ojdbc.version>
        <mybatis.plus.dynamic.version>3.0.0</mybatis.plus.dynamic.version>
        <!-- redisson Setting -->
        <redisson.version>3.11.4</redisson.version>

        <!-- swagger -->
        <swagger.version>2.9.2</swagger.version>
        <swagger.annotations.version>1.5.21</swagger.annotations.version>

        <!-- Elastic Job  Settings-->
        <curator.version>2.10.0</curator.version>
        <elastic.job.version>2.1.5</elastic.job.version>

        <!-- txlcn  Settings-->
        <txlcn.version>5.0.2.RELEASE</txlcn.version>

        <!-- Spring Settings -->
        <spring-cloud.version>Greenwich.RELEASE</spring-cloud.version>
        <spring-cloud-alibaba.version>2.1.0.RELEASE</spring-cloud-alibaba.version>

        <!-- util -->
        <transmittable.version>2.11.0</transmittable.version>
        <hutool.all.version>5.3.9</hutool.all.version>
        <guava.version>23.0</guava.version>
        <viptool.version>1.0.2</viptool.version>
        <commons-csv.version>1.5</commons-csv.version>
        <minio.version>3.0.10</minio.version>
        <orai18n.version>12.1.0.2.0</orai18n.version>
        <poi.version>4.1.2</poi.version>
        <skipTests>true</skipTests>

        <jjwt.version>0.9.1</jjwt.version>
        <micrometer-jvm-extras.version>0.2.2</micrometer-jvm-extras.version>

        <!-- 沃壤 -->
        <sipsdx.worang.version>3.1.0</sipsdx.worang.version>
        <validation-api.version>1.0.0</validation-api.version>

        <!-- sa-token -->
        <sa-token.version>1.29.0</sa-token.version>

    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>${spring-cloud.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>com.alibaba.cloud</groupId>
                <artifactId>spring-cloud-alibaba-dependencies</artifactId>
                <version>${spring-cloud-alibaba.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <plugins>
            <!-- Compiler 插件, 设定 JDK 版本 -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <showWarnings>true</showWarnings>
                </configuration>
            </plugin>

            <!-- 打包 jar 文件时,配置 manifest 文件,加入 lib 包的 jar 依赖 -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                    <archive>
                        <addMavenDescriptor>false</addMavenDescriptor>
                    </archive>
                </configuration>
                <executions>
                    <execution>
                        <configuration>
                            <archive>
                                <manifest>
                                    <!-- Add directory entries -->
                                    <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                                    <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
                                    <addClasspath>true</addClasspath>
                                </manifest>
                            </archive>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <!-- resource -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
            </plugin>

            <!-- install -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-install-plugin</artifactId>
            </plugin>

            <!-- clean -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-clean-plugin</artifactId>
            </plugin>

            <!-- ant -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
            </plugin>

            <!-- dependency -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
            </plugin>
        </plugins>

        <pluginManagement>
            <plugins>
                <!-- Java Document Generate -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-javadoc-plugin</artifactId>
                    <executions>
                        <execution>
                            <phase>prepare-package</phase>
                            <goals>
                                <goal>jar</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </pluginManagement>

        <!-- 资源文件配置 -->
        <resources>
            <resource>
                <directory>src/main/java</directory>
                <excludes>
                    <exclude>**/*.java</exclude>
                </excludes>
            </resource>
            <resource>
                <directory>src/main/resources</directory>
            </resource>
        </resources>
    </build>

    <repositories>
        <repository>
            <id>osgeo</id>
            <name>OSGeo Release Repository</name>
            <url>https://repo.osgeo.org/repository/release/</url>
            <snapshots><enabled>false</enabled></snapshots>
            <releases><enabled>true</enabled></releases>
        </repository>
        <!-- 有多个副本,减少重复代码 -->
        <repository>
            <id>repo-mirror</id>
            <url>https://simulation.tudelft.nl/maven/</url>
        </repository>

        <repository>
            <id>aliyun-repos</id>
            <name>Aliyun Repository</name>
            <url>http://maven.aliyun.com/nexus/content/groups/public</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
        <!-- 推送到中央仓库 -->
        <repository>
            <id>sonatype-repos</id>
            <name>Sonatype Repository</name>
            <url>https://oss.sonatype.org/content/groups/public</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
        <repository>
            <id>sonatype-repos-s</id>
            <name>Sonatype Repository</name>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
            <releases>
                <enabled>false</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>
        <!-- 快照 -->
        <repository>
            <id>spring-snapshots</id>
            <name>Spring Snapshots</name>
            <url>https://repo.spring.io/snapshot</url>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>
        <repository>
            <id>spring-milestones</id>
            <name>Spring Milestones</name>
            <url>https://repo.spring.io/milestone</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
    </repositories>

    <pluginRepositories>
        <pluginRepository>
            <id>aliyun-repos</id>
            <name>Aliyun Repository</name>
            <url>http://maven.aliyun.com/nexus/content/groups/public</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </pluginRepository>
    </pluginRepositories>
</project>

创建 gateway网关项目

标签:项目,springcloudalibaba,plugins,maven,spring,apache,org,true,搭建
来源: https://www.cnblogs.com/2393920029-qq/p/16517486.html