java - 带波形符的 URL 的 Maven groupId

标签 java maven url

Maven groupId 如何用于 URL,例如

site.com/~myname/projectname

成立?

最佳答案

groupId 不必基于域(或本例中的 url)。 id 用于构造本地目录路径,因此不能只使用完整的 url。

常见的做法是以与 java 包名称相同的方式创建 id。但这不是必需的,如果您愿意,您也可以只使用单个单词。

我建议com.site.myname.projectname ,或com.myname.projectname ,取决于您与该网站的关联。即使这是基于域名的,根据 java 包命名指南,您也不需要拥有该域。您应该确保选择相当独特的东西。

如果您只是想引导用户访问您的网站,您可以将其添加到 <url> 中元素。

来自Maven POM Reference :

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/

相关文章:

java - NetBeans 中的命令行参数

postgresql - postgres 的 Flyway 迁移挂起并发创建索引

正则表达式使用通配符验证网址?

php - 将 URL 转换为一种标准格式

c# - 如何检查一个url是否有子字符串

java - Windows 服务器上的简单 Java 应用程序......我应该使用 Java EE

java - 为什么不使用自定义构造函数推断变量记录组件?

java - Gradle 的 Java 项目的默认项目布局

java - Maven shade - 使用自定义配置重新打包依赖 jar

java - 将 Facebook 登录添加到 spring mvc 项目时出现 BeanCreationException