問題:
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). 就像我一樣,我想使用完善的約定來查找groupId
和artifactId
,但是我找不到任何詳細的約定(有一些約定,但是它們沒有涵蓋我想知道的要點)。
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
(?) groupId
: com.mycompany.awesomeinhouseframework
(?)
artifactId
: awesome-inhouse-framework
(?) artifactId
: awesome-inhouse-framework
(?)
解決方案:
參考一: https://en.stackoom.com/question/FctD參考二: https://stackoom.com/question/FctD