Maven groupId
如何用于 URL,例如
site.com/~myname/projectname
成立?
最佳答案
groupId 不必基于域(或本例中的 url)。 id 用于构造本地目录路径,因此不能只使用完整的 url。
常见的做法是以与 java 包名称相同的方式创建 id。但这不是必需的,如果您愿意,您也可以只使用单个单词。
我建议com.site.myname.projectname
,或com.myname.projectname
,取决于您与该网站的关联。即使这是基于域名的,根据 java 包命名指南,您也不需要拥有该域。您应该确保选择相当独特的东西。
如果您只是想引导用户访问您的网站,您可以将其添加到 <url>
中元素。
groupId: This is generally unique amongst an organization or a project. For example, all core Maven artifacts do (well, should) live under the groupId org.apache.maven. Group ID's do not necessarily use the dot notation, for example, the junit project. Note that the dot-notated groupId does not have to correspond to the package structure that the project contains. It is, however, a good practice to follow. When stored within a repository, the group acts much like the Java packaging structure does in an operating system. The dots are replaced by OS specific directory separators (such as '/' in Unix) which becomes a relative directory structure from the base repository. In the example given, the org.codehaus.mojo group lives within the directory $M2_REPO/org/codehaus/mojo.
关于java - 带波形符的 URL 的 Maven groupId,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20231058/