Tag Archives: Maven study notes

Prompt unknown error in pom.xml of Maven project

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