【Spring Cloud Alibaba】1.项目搭建与依赖管理

文章目录

  • 项目创建
  • 修改pom.xml
  • 删除src

引入需要的依赖,进行统一管理。

项目创建

【Spring Cloud Alibaba】1.项目搭建与依赖管理_第1张图片
【Spring Cloud Alibaba】1.项目搭建与依赖管理_第2张图片
创建完成后目录
【Spring Cloud Alibaba】1.项目搭建与依赖管理_第3张图片

修改pom.xml

pom.xml内容如下:


<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>
	<parent>
        <groupId>org.springframework.bootgroupId>
        <artifactId>spring-boot-starter-parentartifactId>
        <version>2.2.4.RELEASEversion>
    parent>
    <groupId>com.mooncegroupId>
    <artifactId>spring-cloud-alibabaartifactId>
    <version>1.0-SNAPSHOTversion>
    
    <properties>
        
        <java.version>1.8java.version>
        <project.build.sourceEncoding>UTF-8project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8project.reporting.outputEncoding>

        
        <spring-cloud.version>Hoxton.SR1spring-cloud.version>
        <spring-cloud-alibaba.version>2.2.0.RELEASEspring-cloud-alibaba.version>
    properties>

    <dependencyManagement>
        <dependencies>
            
            <dependency>
                <groupId>org.springframework.cloudgroupId>
                <artifactId>spring-cloud-dependenciesartifactId>
                <version>${spring-cloud.version}version>
                <type>pomtype>
                <scope>importscope>
            dependency>
            
            <dependency>
                <groupId>com.alibaba.cloudgroupId>
                <artifactId>spring-cloud-alibaba-dependenciesartifactId>
                <version>${spring-cloud-alibaba.version}version>
                <type>pomtype>
                <scope>importscope>
            dependency>
        dependencies>
    dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>org.projectlombokgroupId>
            <artifactId>lombokartifactId>
        dependency>
    dependencies>

    <build>
        <plugins>
            
            <plugin>
                <groupId>org.apache.maven.pluginsgroupId>
                <artifactId>maven-compiler-pluginartifactId>
                <configuration>
                    <showWarnings>trueshowWarnings>
                configuration>
            plugin>

            
            <plugin>
                <groupId>org.apache.maven.pluginsgroupId>
                <artifactId>maven-jar-pluginartifactId>
                <configuration>
                    <archive>
                        <addMavenDescriptor>falseaddMavenDescriptor>
                    archive>
                configuration>
                <executions>
                    <execution>
                        <configuration>
                            <archive>
                                <manifest>
                                    
                                    <addDefaultImplementationEntries>trueaddDefaultImplementationEntries>
                                    <addDefaultSpecificationEntries>trueaddDefaultSpecificationEntries>
                                    <addClasspath>trueaddClasspath>
                                manifest>
                            archive>
                        configuration>
                    execution>
                executions>
            plugin>

            
            <plugin>
                <groupId>org.apache.maven.pluginsgroupId>
                <artifactId>maven-resources-pluginartifactId>
            plugin>

            
            <plugin>
                <groupId>org.apache.maven.pluginsgroupId>
                <artifactId>maven-install-pluginartifactId>
            plugin>

            
            <plugin>
                <groupId>org.apache.maven.pluginsgroupId>
                <artifactId>maven-clean-pluginartifactId>
            plugin>

            
            <plugin>
                <groupId>org.apache.maven.pluginsgroupId>
                <artifactId>maven-antrun-pluginartifactId>
            plugin>

            
            <plugin>
                <groupId>org.apache.maven.pluginsgroupId>
                <artifactId>maven-dependency-pluginartifactId>
            plugin>
        plugins>

        <pluginManagement>
            <plugins>
                
                <plugin>
                    <groupId>org.apache.maven.pluginsgroupId>
                    <artifactId>maven-javadoc-pluginartifactId>
                    <executions>
                        <execution>
                            <phase>prepare-packagephase>
                            <goals>
                                <goal>jargoal>
                            goals>
                        execution>
                    executions>
                plugin>

                
                <plugin>
                    <groupId>net.alchim31.mavengroupId>
                    <artifactId>yuicompressor-maven-pluginartifactId>
                    <version>1.5.1version>
                    <executions>
                        <execution>
                            <phase>prepare-packagephase>
                            <goals>
                                <goal>compressgoal>
                            goals>
                        execution>
                    executions>
                    <configuration>
                        <encoding>UTF-8encoding>
                        <jswarn>falsejswarn>
                        <nosuffix>truenosuffix>
                        <linebreakpos>30000linebreakpos>
                        <force>trueforce>
                        <includes>
                            <include>**/*.jsinclude>
                            <include>**/*.cssinclude>
                        includes>
                        <excludes>
                            <exclude>**/*.min.jsexclude>
                            <exclude>**/*.min.cssexclude>
                        excludes>
                    configuration>
                plugin>
            plugins>
        pluginManagement>

        
        <resources>
            <resource>
                <directory>src/main/javadirectory>
                <excludes>
                    <exclude>**/*.javaexclude>
                excludes>
            resource>
            <resource>
                <directory>src/main/resourcesdirectory>
            resource>
        resources>
    build>

    <repositories>
        <repository>
            <id>aliyun-reposid>
            <name>Aliyun Repositoryname>
            <url>http://maven.aliyun.com/nexus/content/groups/publicurl>
            <releases>
                <enabled>trueenabled>
            releases>
            <snapshots>
                <enabled>falseenabled>
            snapshots>
        repository>

        <repository>
            <id>sonatype-reposid>
            <name>Sonatype Repositoryname>
            <url>https://oss.sonatype.org/content/groups/publicurl>
            <releases>
                <enabled>trueenabled>
            releases>
            <snapshots>
                <enabled>falseenabled>
            snapshots>
        repository>
        <repository>
            <id>sonatype-repos-sid>
            <name>Sonatype Repositoryname>
            <url>https://oss.sonatype.org/content/repositories/snapshotsurl>
            <releases>
                <enabled>falseenabled>
            releases>
            <snapshots>
                <enabled>trueenabled>
            snapshots>
        repository>

        <repository>
            <id>spring-snapshotsid>
            <name>Spring Snapshotsname>
            <url>https://repo.spring.io/snapshoturl>
            <snapshots>
                <enabled>trueenabled>
            snapshots>
        repository>
        <repository>
            <id>spring-milestonesid>
            <name>Spring Milestonesname>
            <url>https://repo.spring.io/milestoneurl>
            <snapshots>
                <enabled>falseenabled>
            snapshots>
        repository>
    repositories>

    <pluginRepositories>
        <pluginRepository>
            <id>aliyun-reposid>
            <name>Aliyun Repositoryname>
            <url>http://maven.aliyun.com/nexus/content/groups/publicurl>
            <releases>
                <enabled>trueenabled>
            releases>
            <snapshots>
                <enabled>falseenabled>
            snapshots>
        pluginRepository>
    pluginRepositories>
project>

删除src

【Spring Cloud Alibaba】1.项目搭建与依赖管理_第4张图片
到这里主体框架已完成!

你可能感兴趣的:(#,Spring,Cloud,Alibaba,spring,java,spring,boot)