Spring Cloud Alibaba(二) 搭建工程项目

创建项目工程

创建一个普通的工程就可以了, 负责管理模块的开发

POM

一大堆根本记不住的东西,看着复制就好,根据自己需求改



<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0modelVersion>
    <parent>
        <groupId>org.springframework.bootgroupId>
        <artifactId>spring-boot-starter-parentartifactId>
        <version>2.2.0.RELEASEversion>
        <relativePath/> 
    parent>

    <groupId>com.examplegroupId>
    <artifactId>hello-spring-cloud-alibaba-demoartifactId>
    <version>0.0.1-SNAPSHOTversion>
    
    <packaging>pompackaging>

    
    <properties>
        <java.version>1.8java.version>
        
        <maven.compiler.source>${java.version}maven.compiler.source>
        
        <maven.compiler.target>${java.version}maven.compiler.target>

        
        <project.build.sourceEncoding>UTF-8project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8project.reporting.outputEncoding>
    properties>

    
    <licenses>
        <license>
            <name>Apache 2.0name>
            <url>https://www.apache.org/licenses/LICENSE-2.0.txturl>
        license>
    licenses>
    <developers>
        <developer>
            <id>Tangid>
            <name>Tang Temname>
            <email>[email protected]email>
        developer>
    developers>

    
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>com.funtlgroupId>
                <artifactId>hello-spring-cloud-alibaba-dependenciesartifactId>
                <version>${project.version}version>
                <type>pomtype>
                <scope>importscope>
            dependency>
        dependencies>
    dependencyManagement>


    
    <profiles>
        <profile>
            <id>defaultid>
            <activation>
                <activeByDefault>trueactiveByDefault>
            activation>

            
            <properties>
                <spring-javaformat.version>0.0.12spring-javaformat.version>
            properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>io.spring.javaformatgroupId>

                        
                        <artifactId>spring-javaformat-maven-pluginartifactId>
                        <version>${spring-javaformat.version}version>
                    plugin>
                    <plugin>
                        <groupId>org.apache.maven.pluginsgroupId>
                        <artifactId>maven-surefire-pluginartifactId>
                        <configuration>
                            <includes>
                                <include>**/*Tests.javainclude>
                            includes>
                            <excludes>
                                <exclude>**/Abstract*.javaexclude>
                            excludes>
                            <systemPropertyVariables>
                                <java.security.egd>file:/dev/./urandomjava.security.egd>
                                <java.awt.headless>truejava.awt.headless>
                            systemPropertyVariables>
                        configuration>
                    plugin>
                    <plugin>
                        <groupId>org.apache.maven.pluginsgroupId>
                        <artifactId>maven-enforcer-pluginartifactId>
                        <executions>
                            <execution>
                                <id>enforce-rulesid>
                                <goals>
                                    <goal>enforcegoal>
                                goals>
                                <configuration>
                                    <rules>
                                        <bannedDependencies>
                                            <excludes>
                                                <exclude>commons-logging:*:*exclude>
                                            excludes>
                                            <searchTransitive>truesearchTransitive>
                                        bannedDependencies>
                                    rules>
                                    <fail>truefail>
                                configuration>
                            execution>
                        executions>
                    plugin>
                    <plugin>
                        <groupId>org.apache.maven.pluginsgroupId>
                        <artifactId>maven-install-pluginartifactId>
                        <configuration>
                            <skip>trueskip>
                        configuration>
                    plugin>
                    <plugin>
                        <groupId>org.apache.maven.pluginsgroupId>
                        <artifactId>maven-javadoc-pluginartifactId>
                        <configuration>
                            <skip>trueskip>
                        configuration>
                        <inherited>trueinherited>
                    plugin>
                plugins>
            build>
        profile>
    profiles>

    
    <repositories>
        <repository>
            <id>spring-milestoneid>
            <name>Spring Milestonename>
            <url>https://repo.spring.io/milestoneurl>
            <snapshots>
                <enabled>falseenabled>
            snapshots>
        repository>
        <repository>
            <id>spring-snapshotid>
            <name>Spring Snapshotname>
            <url>https://repo.spring.io/snapshoturl>
            <snapshots>
                <enabled>trueenabled>
            snapshots>
        repository>
    repositories>

    <pluginRepositories>
        <pluginRepository>
            <id>spring-milestoneid>
            <name>Spring Milestonename>
            <url>https://repo.spring.io/milestoneurl>
            <snapshots>
                <enabled>falseenabled>
            snapshots>
        pluginRepository>
        <pluginRepository>
            <id>spring-snapshotid>
            <name>Spring Snapshotname>
            <url>https://repo.spring.io/snapshoturl>
            <snapshots>
                <enabled>trueenabled>
            snapshots>
        pluginRepository>
    pluginRepositories>
project>

创建统一的依赖管理的模块

为了执行单一执行原则,我们就创建一个依赖的模块

同样什么都不需要创建一个,配置pom.xml,这里用正式版了,当然要用正式版,真香~

注意版本问题,spring boot 版本要配对: 看spring官网的配对alibibi版本



<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.0modelVersion>

    <groupId>com.funtlgroupId>
    <artifactId>hello-spring-cloud-alibaba-dependenciesartifactId>
    <version>0.0.1-SNAPSHOTversion>
    <packaging>pompackaging>
    <url>http://www.funtl.comurl>

    <properties>


    properties>

    <licenses>
        <license>
            <name>Apache 2.0name>
            <url>https://www.apache.org/licenses/LICENSE-2.0.txturl>
        license>
    licenses>

    <developers>
        <developer>
            <id>Tangid>
            <name>Tang Temname>
        developer>
    developers>

    <dependencyManagement>
        
        <dependencies>
            <dependency>
                <groupId>com.alibaba.cloudgroupId>
                <artifactId>spring-cloud-alibaba-dependenciesartifactId>
                <version>2.1.0.RELEASEversion>
                <type>pomtype>
                <scope>importscope>
            dependency>
        dependencies>

    dependencyManagement>

    
    <repositories>
        <repository>
            <id>spring-milestoneid>
            <name>Spring Milestonename>
            <url>https://repo.spring.io/milestoneurl>
            <snapshots>
                <enabled>falseenabled>
            snapshots>
        repository>
        <repository>
            <id>spring-snapshotid>
            <name>Spring Snapshotname>
            <url>https://repo.spring.io/snapshoturl>
            <snapshots>
                <enabled>trueenabled>
            snapshots>
        repository>
    repositories>

    <pluginRepositories>
        <pluginRepository>
            <id>spring-milestoneid>
            <name>Spring Milestonename>
            <url>https://repo.spring.io/milestoneurl>
            <snapshots>
                <enabled>falseenabled>
            snapshots>
        pluginRepository>
        <pluginRepository>
            <id>spring-snapshotid>
            <name>Spring Snapshotname>
            <url>https://repo.spring.io/snapshoturl>
            <snapshots>
                <enabled>trueenabled>
            snapshots>
        pluginRepository>
    pluginRepositories>

project>
        

你可能感兴趣的:(spring,cloud,alibaba)