未从 BOM 文件解析依赖项 [英] Dependency not resolved from BOM file
本文介绍了未从 BOM 文件解析依赖项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
尝试使用 BOM 文件重新设置依赖项,但以下配置不起作用.
Trying to reslove dependency using BOM file but below configuration is not working.
=== BOM 文件配置 ===
=== BOM File configuration ===
<?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>demo</groupId>
<artifactId>bom-dependency</artifactId>
<version>0.0.1</version>
<packaging>pom</packaging>
<name>bom-dependency</name>
<description>BOM dependency</description>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc8</artifactId>
<version>12.2.0.1</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
</project>
=== POM 文件配置 ===
=== POM file configuration ===
<?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>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.0.RELEASE</version>
<relativePath />
</parent>
<groupId>com.demo</groupId>
<artifactId>Test</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>Test</name>
<description>Demo Project</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>demo</groupId>
<artifactId>bom-dependency</artifactId>
<version>0.0.1</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc8</artifactId>
<version>12.2.0.1</version>
</dependency>
</project>
谁能告诉我为什么它不依赖 BOM 文件?
Can someone please let me why its not taking dependency from BOM file?
推荐答案
移除
<type>pom</type>
<scope>import</scope>
从 BOM 中的定义中删除测试项目中依赖项的版本号.
from the definition in your BOM and remove the version number of the dependency in your test project.
这篇关于未从 BOM 文件解析依赖项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文