java - 模块可以与父模块具有相同的artifactID吗? |梅文

标签 java maven

我有一个具有以下结构的 Maven 项目:

parent (artifactID: ABC)
 |
 |---- module 1 (artifactID: ***)
 |---- module 2 (artifactID: XYZ)

模块 1 可以有 artifactID:ABC 吗?

我的父模块只是为了将模块打包在一起。它没有自己的任何源代码。

Maven 是否考虑模块的层次结构来区分两个模块?如果不是为什么?
区分两个同名但在不同地点的人应该不难。

最佳答案

groupId相同时,artifactId必须不同。

作为专家 docs状态,groupId 必须是全局唯一的,并且 artifactIdgroupId 内必须是唯一的。

groupId

A universally unique identifier for a project. It is normal to use a fully-qualified package name to distinguish it from other projects with a similar name

artifactId

The identifier for this artifact that is unique within the group given by the group ID.

关于java - 模块可以与父模块具有相同的artifactID吗? |梅文,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51464197/

相关文章:

java - 为什么唯一多重约束的 JPA 声明在 mySQL 中有效,但在 SQLite 中无效

java - 终身 Collection 无明显原因启动

java - Apache ISIS : Set HTTP-Response

java - Log4j2 - RootLogger 附加程序不工作

bash - 在 IntelliJ Idea 中运行 Maven 目标之前运行 bash 脚本

java - 错误消息 : "Project build error: Non-parseable POM

java - 运行 java jar - 没有主 list 属性错误

java - 从 spring 获取 bean 时使用哪个 context.getBean

java.sql.SQLException : Access denied for user 'app1' @'127.0.0.1' (using password: YES)

java - Maven 和 Java : The parameters 'mainClass' for goal org. codehaus.mojo :exec-maven-plugin:1. 2.1:java 丢失或无效