Maven命名约定

有关groupId,artifactId和版本的命名约定指南

  • groupId 将在所有项目中唯一标识您的项目,所以我们需要强制执行一个命名模式。它必须遵循软件包名称规则,这意味着必须至少作为您控制的域名,并且您可以根据需要创建任意数量的子组。查看有关软件包名称的更多信息。
    例如。org.apache.maven,org.apache.commons

    确定groupId粒度的一种好方法是使用项目结构。也就是说,如果当前项目是多模块项目,它应该向父项的groupId附加一个新的标识符。

    例如。org.apache.maven,org.apache.maven.plugins,org.apache.maven.reporting

  • artifactId 是没有版本的jar名称。如果你创建了它,那么你可以选择任何你想要的名字,用小写字母和没有奇怪的符号。如果它是第三方jar,则必须在分发jar时使用它的名称。
    例如。maven,commons-math

  • 版本如果你分发它,那么你可以选择任何典型的版本号码和点(1.0,1.1,1.0.1,…)。不要使用日期,因为它们通常与SNAPSHOT(夜间)版本相关联。如果它是第三方神器,无论它是什么,都必须使用它们的版本号,并且看起来很奇怪。
    例如。2.0,2.0.1,1.3.1


官网原文

地址: https://maven.apache.org/guides/mini/guide-naming-conventions.html(Maven命名约定)

    Guide to naming conventions on groupId, artifactId and version
    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. Look at More information about package names.
    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

    artifactId is the name of the jar without version. If you created it then you can choose whatever name you want with lowercase letters and no strange symbols. If it's a third party jar you have to take the name of the jar as it's distributed.
    eg. maven, commons-math

    version if you distribute it then you can choose any typical version with numbers and dots (1.0, 1.1, 1.0.1, ...). Don't use dates as they are usually associated with SNAPSHOT (nightly) builds. If it's a third party artifact, you have to use their version number whatever it is, and as strange as it can look.
    eg. 2.0, 2.0.1, 1.3.1

Maven命名约定_第1张图片

你可能感兴趣的:(环境配置)