我在 GitHub 上托管了一个开源 Maven 项目。假设网址是 https://github.com/foo/bar .
现在我想将它上传到 Sonatype OSS Maven Repository。我检查过他们对 groupId ( https://docs.sonatype.org/display/Repository/Choosing+your+Coordinates ) 有严格的规定。
groupId will identify your project uniquely across all projects, so we need to enforce a naming schema. It has to follow the package name rules, what means that has to be at least as a domain name you control, and you can create as many subgroups as you want. eg. org.apache.maven, org.apache.commons A good way to determine the granularity of the groupId is to use the project structure. That is, if the current project is a multiple module project, it should append a new identifier to the parent's groupId. eg. org.apache.maven, org.apache.maven.plugins, org.apache.maven.reporting
问题是对于托管在 GitHub 上的项目,什么是合适的 groudId?
由于用户生成的网站有域名 foo.github.io,我至少有以下两个选择:
- com.github.foo
- io.github.foo
最佳答案
在名称中使用带有托管站点的 groupId 是一种流行的选择。搜索http://search.maven.org对于
- 网络.sf
- 源代码
- 谷歌代码
- github
虽然最好使用您真正拥有的域,但使用 groupId 中的托管站点是一个明智的退路。您应尽量确保选择的名称与托管公司本身无关(例如 com.google),但与托管站点相关联(例如 com.googlecode),以便清楚地表明您是该站点上的一个项目而不是基础公司的项目。
关于java - GitHub 上托管的 maven 项目的 groupId,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19924980/