当前位置:网站首页>Groupid(artifact id)
Groupid(artifact id)
2022-07-31 14:24:00 【全栈程序员站长】
大家好,又见面了,我是你们的朋友全栈君。
什么是groupid和artifactId?
groupid和artifactId被统称为“坐标”是为了保证项目唯一性而提出的,如果你要把你项目弄到maven本地仓库去,你想要找到你的项目就必须根据这两个id去查找。 groupId和artifactId是maven管理项目包时用作区分的字段,就像是地图上的坐标。 artifactId:artifactId一般是项目名或者模块名。 groupId:groupId分为几个字段,例如cn.com.fullstack,前面的com叫【域】,后面的是你自己起的域名。 groupId一般分为多个段,这里我只说两段,第一段为域,第二段为公司名称。域又分为org、com、cn等等许多,其中org为非营利组织,com为商业组织。举个apache公司的tomcat项目例子:这个项目的groupId是org.apache,它的域是org(因为tomcat是非营利项目),公司名称是apache,artigactId是tomcat。
【作用】
一般来说,包名根目录=groupId+artifactId。这个是不允许和别人重复的,尤其是需要上线的项目。一般公司为了不重复都会注册一个域名(URL用的那种),这样就肯定不会重复了。
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> springboot项目创建必须继承父类
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.0.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent> GAV坐标
<groupId>com.offcn</groupId>
<artifactId>springbootdemo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>springbootdemo</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies> springboot必须有的两个依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
<!--lombok依赖代替实体类中方法的 -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.10</version>
</dependency>
发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/128455.html原文链接:https://javaforall.cn
边栏推荐
猜你喜欢
Open Inventor 10.12 Major Improvements - Harmony Edition
OAuth2:搭建授权服务器
Resolved (pymysqL connect to the database error) pymysqL. Err. ProgrammingError: (1146, "Table" test. Students' doesn 't exist ")
MySQL [subquery]
AWS实现定时任务-Lambda+EventBridge
Asynchronous processing business using CompletableFuture
「面经分享」西北大学 | 字节 生活服务 | 一面二面三面 HR 面
尚硅谷-JVM-内存和垃圾回收篇(P1~P203)
IDEA连接MySQL数据库并使用数据
OAuth2:单点登陆客户端
随机推荐
The 232-layer 3D flash memory chip is here: the single-chip capacity is 2TB, and the transmission speed is increased by 50%
4.爬虫之Scrapy框架2数据解析&配置参数&数据持久化&提高Scrapy效率
The recently popular domestic interface artifact Apipost experience
Analysis of the startup source code of hyperf (2) - how the request reaches the controller
UnityShader入门学习(一)——GPU与Shader
OAuth2:单点登陆客户端
[QNX Hypervisor 2.2用户手册]9.13 rom
MySQL has played to such a degree, no wonder the big manufacturers are rushing to ask for it!
Nuget打包并上传教程
For enterprises in the digital age, data governance is difficult, but it should be done
龟速乘【模板】
新款现代帕里斯帝预售开启,安全、舒适一个不落
MySQL 23道经典面试吊打面试官
[QNX Hypervisor 2.2 User Manual]9.14 safety
OpenShift 4 - 定制 RHACS 安全策略,阻断生产集群使用高风险 Registry
【Pytorch】torch.argmax()用法
The JVM a class loader
三角恒等变换公式
微服务架构选型
Why do we need to sub-library and sub-table?