Maven工件和groupId命名 - Maven artifact and groupId naming

问题:

I'm currently in the process of moving some project from Ant to Maven. 我目前正在将一些项目从Ant移到Maven。 Conformist as I am, I want to use well-established conventions for finding groupId and artifactId , but I can't find any detailed conventions (there are some, but they don't cover the points I'm wondering about). 就像我一样,我想使用完善的约定来查找groupIdartifactId ,但是我找不到任何详细的约定(有一些约定,但是它们没有涵盖我想知道的要点)。

Take this project for instance, first the Java package: com.mycompany.teatimer 以这个项目为例,首先是Java包: com.mycompany.teatimer

Tea timer is actually two words, but the Java package naming conventions forbid the insertion of underscores or hyphens, so I'm writing it all together. Tea timer实际上是两个词,但是Java包命名约定禁止插入下划线或连字符,因此我将它们全部编写在一起。

I chose the groupId identical to the package ID because I think that's a good idea. 我选择与包ID相同的groupId ,因为我认为这是个好主意。 Is it? 是吗?

Finally, I have to pick an artifactId , I currently went for teatimer . 最后,我必须选择一个artifactId ,我目前去了teatimer But when I look at other Maven projects, they use hyphens to split words in artifactId s, like this: tea-timer . 但是,当我查看其他Maven项目时,它们使用连字符来分隔artifactId的单词,例如: tea-timer But it does look weird when concatenated to the groupId : com.mycompany.teatimer.tea-timer . 但是,将其连接到groupId时,看起来确实很奇怪: com.mycompany.teatimer.tea-timer

How would you do this? 你会怎么做?

Another example: 另一个例子:

Package name: com.mycompany.awesomeinhouseframework 程序包名称: com.mycompany.awesomeinhouseframework

groupId : com.mycompany.awesomeinhouseframework (?) groupIdcom.mycompany.awesomeinhouseframework (?)

artifactId : awesome-inhouse-framework (?) artifactIdawesome-inhouse-framework (?)


解决方案:

参考一: https://en.stackoom.com/question/FctD
参考二: https://stackoom.com/question/FctD
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章