Table of Contents
1、MAVEN的运作方式
2、配置国内仓库
前言
参考书是 龙中华 《Spring Boot 实战派》
相关链接:
https://blog.csdn.net/u013840066/article/details/104070447
maven会根据自动dependecies 中配置的依赖项。直接从maven仓库中下来依赖到本地的 ".m2"目录中,默认路径是
"C:\Users\系统名\.m2\repository"
maven文件中配置是conf文件中的setting文件。
我们可以进行相关的修改路径来自定义路径存放依赖。
我们在实际进行依赖添加的时候不需要建议这些东西, 可以直接搜索依赖进行复制。
网址可以是
<!--阿里云 --> https://maven.aliyun.com/ <!--apache 仓库 --> https://repo.maven.apache.org/maven2/这些比较常见。也可以自己添加新的东西。
以阿里云为例。我要添加netty在项目中。可以在网站中搜索,然后找到netty相关依赖
点击名称
复制maven依赖到 maven项目中即可。
<dependencies> .................. ....... ... .... <dependency> <groupId>io.netty</groupId> <artifactId>netty</artifactId> <version>4.1.52.Final</version> <type>jar.sha256</type> </dependency> </dependencies>
如果想手动安装也可以可以。
将jar包下下来 按照相关格式安装即可:
参考我写的另一篇博客:
https://blog.csdn.net/qq_28198181/article/details/90288246
因为默认仓库都是国外的,会比较慢
我们自己也有提供中心仓库的镜像,
可以在maven配置文件中的mirror属性中修改。
方式:
1、找到maven安装目录下的conf文件夹,打开settings.xml文件。
2、找到mirror元素 添加阿里云仓库镜像代码,完成后的文件如下:(部分)
<mirrors> <!-- mirror | Specifies a repository mirror site to use instead of a given repository. The repository that | this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used | for inheritance and direct lookup purposes, and must be unique across the set of mirrors. | <mirror> <id>mirrorId</id> <mirrorOf>repositoryId</mirrorOf> <name>Human Readable Name for this Mirror.</name> <url>http://my.repository.com/repo/path</url> </mirror> --> <mirror> <id>maven-aliyun</id> <mirrorOf>central</mirrorOf> <name>aliyun</name> <url>http://maven.aliyun.com/nexus/content/groups/public</url> </mirror> <mirror> <id>maven-apache</id> <mirrorOf>central</mirrorOf> <name>apache</name> <url>http://repo.maven.apache.org/maven2</url> </mirror> <mirror> <id>jboss-public-repository-group</id> <mirrorOf>central</mirrorOf> <name>JBoss Public Repository Group</name> <url>http://repository.jboss.org/nexus/content/groups/public</url> </mirror> <mirror> <id>JBoss-JBPM</id> <mirrorOf>central</mirrorOf> <name>JBossJBPM Repository</name> <url>https://repository.jboss.org/nexus/content/repositories/releases/</url> </mirror> </mirrors>结尾:
做了两年开发,发现对Spring Boot 的认知上缺少了很多东西。因此想重新认识 Spring Boot 框架 仅此而已。