【dependencyManagement版本管理】dependencies.dependency.version is missing
maven 的gav的v(版本问题)
报错dependencies.dependency.version is missing
出现的场景
一个项目中有多个模块
父模块中出现
dependencies.dependency.version is missing子模块中出现
dependencies.dependency.version is missing
模块结构
父模块结构(pom.xml)
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.wangguofa.cloud</groupId>
<artifactId>cloud</artifactId>
<version>0.0.1</version>
<name>cloud</name>
<packaging>pom</packaging>
<modules>
<module>cloud-common</module>
</modules>
<properties>
<java.version>1.8</java.version>
<mybatis-plus-boot-starter.version>3.3.0</mybatis-plus-boot-starter.version>
<hutool-all.version>5.5.7</hutool-all.version>
<spring-boot.version>2.3.7.RELEASE</spring-boot.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>${mybatis-plus-boot-starter.version}</version>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
</dependency>
</dependencies>
</dependencyManagement>
<!-- 父项目中引入部分依赖 -->
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>${spring-boot.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>
</dependencies>
</project>
点击Maven的生命周期test出现如下错误
[ERROR] 'dependencies.dependency.version' for org.springframework.boot:spring-boot-starter-data-redis:jar is missing. @ line 48, column 21
[ERROR] 'dependencies.dependency.version' for org.springframework.boot:spring-boot-starter-aop:jar is missing. @ line 52, column 21
是因为少写了一个父类的引用,参考链接:https://blog.csdn.net/qq_32198005/article/details/77671803
添加一个<parent>标签
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.7.RELEASE</version>
</parent>
子模块结构(pom.xml)
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>com.wangguofa.cloud</groupId>
<artifactId>cloud</artifactId>
<version>0.0.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>com.wangguofa.cloud</groupId>
<artifactId>cloud-common</artifactId>
<version>0.0.1</version>
<name>cloud-common</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<spring-boot.version>2.3.7.RELEASE</spring-boot.version>
</properties>
<dependencies>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</project>
点击Maven的生命周期test出现如下错误
'dependencies.dependency.version' for cn.hutool:hutool-all:jar is missing. @ line 24, column 21
'dependencies.dependency.version' for org.springframework.boot:spring-boot-starter:jar is missing. @ line 38, column 21
子项目的版本,如果没有添加是根据父项目的,观察到dependencyManagement并没有写这两个的版本,需要在父项目中添加版本
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
<version>${spring-boot.version}</version>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>${hutool-all.version}</version>
</dependency>
【dependencyManagement版本管理】dependencies.dependency.version is missing的更多相关文章
- The POM for XXX:jar:${com.ld.base.service.version} is missing, no dependency information available
最近有个jar改了名字后,有个依赖它的工程死活引用的是老名字,导致打包的时候出错,如下所示: [INFO] ---------------------------------------------- ...
- Maven中的DependencyManagement和Dependencies
Maven 使用dependencyManagement 元素来提供了一种管理依赖版本号的方式.通常会在一个组织或者项目的最顶层的父POM 中看到dependencyManagement 元素.使用p ...
- dependencyManagement与dependencies区别
最近在阅读maven项目代码时,dependencyManagement与dependencies之间的区别不是很了解,现通过项目实例进行总结:项目epps-demob-pom下有一个模块是epps- ...
- dependencyManagement和dependencies的区别
参考:http://zhaoshijie.iteye.com/blog/2094478http://blog.csdn.net/cpf2016/article/details/45674377 还有一 ...
- 问题:dependencyManagement和dependencies有什么区别
dependencyManagement和dependencies有什么区别 一.Maven的包管理 在maven中,dependencyManagement.dependencies和depende ...
- 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique
2016-10-09 23:14:43.177 DEBUG [restartedMain][org.springframework.core.type.classreading.AnnotationA ...
- maven 中的pom中的 dependencyManagement 和 dependencies
参考:maven pom.xml 中 dependencyManagement和dependencies详解 现在的项目基本上都是使用多module来管理的,这就涉及到一个问题,多module之间如何 ...
- 宜立方商城中,mvn报错'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: org.springframework:spring-webmvc:jar报错
'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: org.springframework:s ...
- maven warnning 'build.plugins.plugin.version' is missing
裝完maven后,package或clean时出错:[WARN] [WARN] Some problems were encountered while building the effective ...
随机推荐
- C语言编程 菜鸟练习100题(21-30)
[练习21]计算自然数的和 0. 题目: 计算自然数的和 1. 分析: 练习使用 for 循环结构.for 循环允许一个执行指定次数的循环控制结构. 2. 程序: #include <stdio ...
- MySql多表查询_事务_DCL(资料三)
今日内容 1. 多表查询 2. 事务 3. DCL 多表查询: * 查询语法: select 列名列表 from 表名列表 where.... * 准备sql # 创建部门表 CREATE TABLE ...
- python基础学习之函数基础和部分内置函数
在函数调用的时候,必备参数必须要传入 函数定义: def 函数名: 代码块pass return 返回值 函数名命名规则: 字母.数字和下划线组成,和变量命名规则一致 pass在这里表示什么都没有 ...
- 时间同步chrony,最全最细
时间同步服务 多主机协作工作时,各个主机的时间同步很重要,时间不一致会造成很多重要应用的故障,如:加密协 议,日志,集群等, 利用NTP(Network Time Protocol) 协议使网络中的各 ...
- 图解 | 原来这就是 class
我是一个 .java 文件,名叫 FlashObject.java,叫我小渣就行. public class FlashObject { private String name; priv ...
- vscode配置c\c++环境
目录 一.安装vscode 二.安装插件以及配置c\c++编译环境 1. 安装以下两个插件 2. 配置编译环境 一.安装mingw64(推荐) 方法一 方法二 二.如果你安装过visual studi ...
- 在Ubuntu上安装TensorFlow-GPU开发环境
深度学习是一个比较复杂的体系,今天记录一下开发环境的搭建步骤. 全新安装Ubuntu 20.10,系统默认安装的是python3,查看python的版本: mango@ubuntu:~$ python ...
- 你要偷偷学会排查线上CPU飙高的问题,然后惊艳所有人!
GitHub 20k Star 的Java工程师成神之路,不来了解一下吗! GitHub 20k Star 的Java工程师成神之路,真的不来了解一下吗! GitHub 20k Star 的Java工 ...
- springboot的yml中的bruid没有提示
解决方案: springboot的yml中的bruid没有提示只要在maven加上:druid-spring-boot-starter(注意版本的统一,否则可能会冲突) 效果图:
- [LeetCode]2. 两数相加(难度:中等)
题目: 给你两个非空的链表,表示两个非负的整数.它们每位数字都是按照逆序的方式存储的,并且每个节点只能存储一位数字.请你将两个数相加,并以相同形式返回一个表示和的链表.你可以假设除了数字0之外,这两个 ...