【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 ...
随机推荐
- axios之增删查改操作
一.get方法获取数据 axios.get('url') .then(function (res) { console.log(res); }).catch(function (error) { co ...
- Android的Proxy/Delegate Application框架
转自:http://blogs.360.cn/360mobile/2013/11/25/proxydelegate-application/#comment-77 有的时候,为了实现一些特殊需求,如界 ...
- 【ZeyFraのJavaEE开发小知识05】Mybatis-Plus & Axios
关于如何在Mybatis-Plus中添加SQL拦截器 之前ZeyFra在MyBatis-Plus[踩坑记录01]一文中提到过,使用Mybatis-Plus时最好使用MybatisSqlSessionF ...
- JVM之对象创建、对象内存布局、对象访问定位
对象创建 类加载过后可以直接确定一个对象的大小 对象栈上分配是通过逃逸分析判定.标量替换实现的,即把不存在逃逸的对象拆散,将成员变量恢复到基本类型,直接在栈上创建若干个成员变量 选择哪种分配方式由Ja ...
- 【java框架】SpringBoot(4)--SpringBoot实现异步、邮件、定时任务
1.SpringBoot整合任务机制 1.1.SpringBoot实现异步方法 日常开发中涉及很多界面与后端的交互响应,都不是同步的,基于SpringBoot为我们提供了注解方式实现异步方法.使得前端 ...
- DAOS 分布式异步对象存储|安全模型
DAOS 使用了一个灵活的安全模型,将身份验证和授权分离开来.它的设计令其对 I/O 的影响被降到最小. DAOS 对用于 I/O 传输的网络结构没有提供任何传输安全性保障.在部署 DAOS 时,管理 ...
- 七大php主流框架,你用过几个?
在php中,我们最常用的框架有七个,分别是Yii2.Laravel.Yaf.Thinkphp.Code Igniter.Zend Framework以及CakePHP,今天我们就来详细介绍一下他们.一 ...
- 【2020.8.23NOIP模拟赛】失落
[ 2020.8.23 N O I P 模 拟 赛 ] 失 落 [2020.8.23NOIP模拟赛]失落 [2020.8.23NOIP模拟赛]失落 题目描述 出题人心情很失落,于是他直接告诉你让你求出 ...
- IIS误删了默认网站,恢复方法
有时候安装好IIS后,会不小心把IIS的默认网站删除.重新去新建可能会出现一些错误例如"提示文件已存在无法执行"等奇怪的错误,下面是具体的默认网站的恢复方法 找到目录C:\wind ...
- OOUML系列总结及终章回顾
盼望着,盼望着,OO课程终于结束了,但是,此刻的我却感到一丝失落,甚至想着再来一单元岂不妙哉? 目录 总结本单元三次作业架构 四个单元中架构设计及OO方法理解的演进 四个单元中测试理解与实践的演进 课 ...