SpringCloud integration process dependent jar stepped pit experience

Today in the process of building SpringCloud Eureka, has relied on an error in the newspaper pom, troubleshooting experience are summarized below.

1, SpringBoot integration SpringCloud both versions is strictly constrained, see detailed SpringBoot official documents ( https://spring.io/projects/spring-cloud ):

Correct dependent Example:

 

2, the new version of eureka server depends artifactId has changed, spring boot, spring cloud inside the package a lot of references, including name and other configuration updates quickly, pay attention to always pay attention to the official website.

 <artifactId>spring-cloud-starter-eureka-server</artifactId> ---> <artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>

maven repository official description: https://mvnrepository.com/artifact/org.springframework.cloud/spring-cloud-starter-eureka-server

 3, maven jar package dependencies errors, may not be updated again download the correct jar package, please delete the previously downloaded update download jar package again.

 

4, the correct dependency pom example:

<?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>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.0.2.RELEASE</version>
        <relativePath/>  
    </parent>
    
    <groupId>com.github.gavincoder</groupId>
    <artifactId>eureka-server</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>eureka-server</name> 

    <properties>
        <java.version>1.8</java.version>
    </properties>

    <dependencies>        
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
        </dependency>
        <!--eureka-server服务端引入 -->
       <dependency>
              <groupId>org.springframework.cloud</groupId>
              <artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
       </dependency>
    </dependencies>
    
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>Finchley.SR2</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

</project>

 

Guess you like

Origin www.cnblogs.com/gavincoder/p/11032015.html