Resolve Maven project (springBoot) beginning pom.xml problems Unkown error sub-module

Resolve Maven project (springBoot) beginning pom.xml problems Unkown error sub-module

Background problem

Spring Boot recent study of the process of creating a Maven project by the eclipse, and then based on this Maven project to create a sub-module project, and Maven Module project, but there was a small red cross Unkown error at the beginning of the project pom.xml Maven Module , as shown below:
Here Insert Picture Description
Here Insert Picture Description
where, pom.xml parent Maven project as follows:

<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.wongoing</groupId>
	<artifactId>base-microserver</artifactId>
	<version>0.0.1-SNAPSHOT</version>
	<packaging>pom</packaging>

	<name>base-microserver</name>
	<url>http://maven.apache.org</url>
	
	<modules>
		<module>base-eureka</module>
	</modules>

	<!-- 使用属性设置编译工具的版本和项目的编码方式 -->
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>1.8</java.version>
        <spring-cloud.version>Greenwich.SR1</spring-cloud.version>
        <maven-compiler.version>3.1</maven-compiler.version>
        <maven-surefire.version>2.12.4</maven-surefire.version>
    </properties>
    <!-- 使用父级配置,设定Spring Boot和Spring Cloud的版本 -->
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-parent</artifactId>
        <version>2.1.5.RELEASE</version>
    </parent>

	<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>
        </dependencies>
    </dependencyManagement>

    <!-- 配置starter -->
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>
	
	<!-- 使用统一的插件配置,如果模块中没有相关的构建配置,将默认使用这个配置 -->
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>${maven-compiler.version}</version>
                <configuration>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>${maven-surefire.version}</version>
                <configuration>
                    <skipTests>true</skipTests>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

pom.xml content in the child Maven Module as follows:

<?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>com.wongoing</groupId>
		<artifactId>base-microserver</artifactId>
		<version>0.0.1-SNAPSHOT</version>
	</parent>
	
	<artifactId>base-eureka</artifactId>
	
	<dependencies>
		<dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
        </dependency>
	</dependencies>
</project>

problem analysis

By looking up related issues found from the Internet, most of these problems are mainly due to the Unkown Error Maven current version does not support versions of dependent libraries caused. Some friends also found directly in the creation of Maven-based Spring Boot project is the emergence of this problem, the solution is to reduce the number of versions Spring Boot. My question now is spring boot rely pom.xml in the main Maven project configured, but an error in the pom.xml submodule. Although skeptical about the idea of ​​this solution, but also give it a try.

problem solved

1, modify main project in Maven pom.xml spring boot version 2.1.5.RELEASE to 2.1.4.RELEASE, and saved, waiting for the end of the project compilation.
2, sub-module Maven project right mouse button, the pop-up menu, select Maven-> Update Project, wait for the update is completed.
After these two operations found pom.xml submodule in Unkown error red cross disappeared, and the red cross on project disappeared, everything is normal, as shown below:
Here Insert Picture Description
At this point, solve this problem perfect, hope use eclipse development spring boot to help a friend.

Published 138 original articles · won praise 303 · views 120 000 +

Guess you like

Origin blog.csdn.net/zlbdmm/article/details/105367360