Today, we learn how to build a spring cloud foundation project. Pom.xml file prompts unknown error exception.
Try to solve the problem: I prefer to rely on Maven project and check whether the jar package that Maven project relies on is downloaded to the local warehouse normally, but none of them solve the problem.
After Googling, I found that many students met this situation, and I also found the cause of the problem.
Cause of the problem: there is a conflict between the spring boot version of Maven project and the Maven jar plugin version.
Solution version: reduce Maven jar plugin version
Pom.xml instance:
<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.zzg</groupId>
<artifactId>cx-cloud</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<description>CX-Cloud:Microservice Rights Management System</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.4.4</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<!--set the version -->
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
<spring-boot.version>2.4.4</spring-boot.version>
<spring-cloud.version>2020.0.2</spring-cloud.version>
<maven-jar-plugin.version>3.1.1</maven-jar-plugin.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>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>${maven-jar-plugin.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<modules>
<module>cx-commons</module>
<module>cx-common</module>
<module>cx-auth</module>
<module>cx-server</module>
</modules>
</project>
Note: the point is to specify the Maven jar plugin version in the properties version tab
Read More:
- [Maven] Pom.xml error: Cannot detect Web Project version.
- [Solved] Read file XXX /pom.xml Error when Maven is configured in idea
- [Solved] Maven Error: parent.relativePath points at wrong local POM
- Maven package error: [WARNING] The POM for xxx is missing, no dependency inform
- Gateway Error: Cannot resolve org.springframework.cloud:spring-cloud-starter-gateway:unknown
- Springboot package error: failed to execute goal org.apache.maven.plugins:maven-resources-plugin: 3.2.0…
- Start error in maven web project java.lang.ClassNotFoundException: org.springframework.web.util.Log4jConfigListener
- [Solved] STS Console Error: error unknown mavem Maven Configuration Problem
- [Solved] Maven Error: The packaging for this project did not assign a file to the build artifact
- An error was reported when Maven package was running the packaged jar package: there is no main list attribute in xxx.jar, which can be solved by configuring Maven plugin
- Solve Maven project running error Failed to clean project: Failed to delete
- XML read process error: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,1] Message: Content not allowed in preamble
- [Solved] presto Compile Error: Failed to execute goal org.apache.maven.plugins:maven-checkstyle-plugin:3.0.0:check
- [neo4j] error report when visiting neo4j in spring boot project
- [Solved] Spring cloud introduces zuul dependency error
- Unable to import maven project: See logs for details [Solved]
- How to Solve Maven Error: Failure to transfer com.thoughtworks.xstream:xstream:jar:1.3.1 from https://repo.maven.ap
- Maven configuration error: JAVA_HOME not found in your environment
- [Solved] Failed to bind properties under ‘spring.datasource.type‘ to java.lang.Class<javax.sql.DataSource>