java - GitHub 上托管的 maven 项目的 groupId

标签 java maven github sonatype

我在 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/

相关文章:

java - 如何在 Hibernate 注解中创建 Tinyint Field

java - 刚接触 Maven,在构建时看到问题 Malformed POM G :\WorkSpace\Test\pom. xml: Unrecognized tag: 'pluginRepositories'

java - 为什么 javafx-maven-plugin :jlink cause a java. nio.file.AccessDeniedException?

maven - 如何使用 Hudson/Jenkins 和 Maven 将静态 Web 资源发布到 Amazon S3?

html - 如何将 index.html 与 github 上的其他 .html 文件放在同一个文件夹中?

java - Player 中的 setPlayerHp() 不能应用于整数

java - 在执行gradle run时防止JVM终止

visual-studio - 当我尝试在 ubuntu 中使用 VS 安装 jquery-csv 库时,为什么 npm 会给我警告

git - 从原始 GitHub 存储库中 pull 新的更新到 fork 的 GitHub 存储库中

java - 如何将 Joda-Time DateTime 格式化为仅 mm/dd/yyyy?