我得到了以下情况:diag-parent
(超级POM(和diag-domain
(儿童(
超级绒球:
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>de.dbsystel.udg</groupId>
<artifactId>udg-super-pom</artifactId>
<version>2.0.3</version>
<relativePath/>
</parent>
<groupId>de.db.udg.diagnose.udg-diagnose</groupId>
<artifactId>diag-parent</artifactId>
<packaging>pom</packaging>
<version>1.20.16-SNAPSHOT</version>
<name>${project.artifactId}</name>
<modules>
<module>diag-domain</module>
</modules>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>de.db.kolt.alice</groupId>
<artifactId>alice</artifactId>
<version>2.2.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>7.0</version>
</dependency>
<!-- PrimeFaces File Upload utils -->
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.2.1</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.6</version>
</dependency>
...
</dependencies>
</dependencyManagement>
儿童聚甲醛:
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>de.db.udg.diagnose.udg-diagnose</groupId>
<artifactId>diag-parent</artifactId>
<version>1.20.16-SNAPSHOT</version>
</parent>
<artifactId>diag-domain</artifactId>
<packaging>jar</packaging>
<name>${project.artifactId}</name>
...
</project>
编译诊断域模块会导致:
Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project diag-domain: Compilation failure: Compilation failure:
[ERROR] /D:/Projekte/FA-DIAGNOSE/UDG-DIAGNOSE/branches/Richface_Migration/impl/diag-domain/src/main/java/de/db/udg/diagnose/udgdiag/domain/base/ToManyAssociationModel.java:[13,28] package org.primefaces.model does not exist
它显然不会从diag-parent
获取任何依赖项。甚至我的 .m2 存储库也是空的。
diag-domain
的有效绒球:
<!-- ====================================================================== -->
<!-- -->
<!-- Generated on 2020-01-09T11:13:57 -->
<!-- -->
<!-- ====================================================================== -->
<!-- ====================================================================== -->
<!-- -->
<!-- Effective POM for project -->
<!-- 'de.db.udg.diagnose.udg-diagnose:diag-domain:jar:1.20.16-SNAPSHOT' -->
<!-- -->
<!-- ====================================================================== -->
<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>
<parent>
<groupId>de.db.udg.diagnose.udg-diagnose</groupId>
<artifactId>diag-parent</artifactId>
<version>1.20.16-SNAPSHOT</version>
</parent>
<groupId>de.db.udg.diagnose.udg-diagnose</groupId>
<artifactId>diag-domain</artifactId>
<version>1.20.16-SNAPSHOT</version>
<name>diag-domain</name>
<description>domain objects</description>
<dependencyManagement>
<dependencies>
...
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>7.0</version>
<scope>compile</scope>
</dependency>
...
</dependencyManagement>
</dependencies>
</project>
<dependencyManagement>
中的条目不是依赖项。它们只是依赖项的标准版本。
依赖项需要位于<dependencyManagement>
之外的<dependencies>
标记中。
由于您只使用dependencyManagement
因此不会导入依赖项。 您需要子pom中的<dependencies>
部分,然后输入依赖项。
<depenencyManagement>
仅用于标记所有子模块使用情况的某些版本的依赖项。
请参阅:https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Dependency_Management
当您有一组从公共父级继承的项目时,可以将有关依赖项的所有信息放在公共 POM 中,并在子 POM 中对工件进行更简单的引用