
<!--在dependencyManagement 声明的依赖不会实际引入到模块中 -->
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>2.7.5</version>
</dependency>
</dependencies>
</dependencyManagement>如果需要使用该依赖,则应该在 dependencies 中重新声明该依赖
<!--如果需要使用,在dependencies中声明该依赖,无须指定版本-->
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>如果是在子类中,需要先引入父模块,再引用依赖
<!--引入父模块, parent标签可以理解为java中的继承关系-->
<parent>
<groupId>父类 groupId</groupId>
<artifactId>父类 artifactId</artifactId>
<version>父类 version</version>
</parent>
<!--如果需要使用,在dependencies中声明该依赖,无须指定版本-->
<dependencies>
<dependency>
<!--如果指定了版本号,则会覆盖父模块 dependencyManagement 定义的版本(不建议这
做,dependencyManagement的作用本来就是用来统一版本,防止依赖冲突)-->
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>使用 dependencyManagement 可以统一声明依赖版本,进行集中管理,避免依赖冲突
distributionManagement 的作用是"分发构件至远程仓库":
mvn install 会将项目生成的构件安装到本地 Maven 仓库,mvn deploy 用来将项目生成的构件分发到远程 Maven 仓库。本地 Maven 仓库的构件只能供当前用户使用,在分发到远程 Maven 仓库之后,所有能访问该仓库的用户都能使用你的构件。
我们需要配置 POM 的 distributionManagement 来指定 Maven 分发构件的位置。给出 Maven 部署当前项目的构件到远程库时,关于远程库的配置。
<distributionManagement>
<repository>
<id>随便起</id>
<url>你自己maven环境下setting文件里面的私有库</url>
</repository>
<snapshotRepository>
<id>随便起t</id>
<url>你自己maven环境下setting文件里面的快照库</url>
</snapshotRepository>
</distributionManagement>Git 是一个开源的分布式版本控制系统,由 Linus Torvalds 创建,用于有效、高速地处理从小到大的项目版本管理。Git 是目前世界上最流行的版本控制系统之一,广泛应用于软件开发中。
以下是 Git 的一些核心概念和功能:
Git 的命令行工具非常强大,但同时也有图形用户界面(GUI)客户端,如 GitHub Desktop、SourceTree、GitKraken 等,使得非技术用户也能轻松使用 Git。
Git 通常与 GitHub、GitLab 或 Bitbucket 等在线托管服务一起使用,这些服务提供了额外的功能,如代码审查、持续集成/持续部署(CI/CD)、项目管理工具等。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。