idea怎样导入Thymeeaf模板引擎,以及遇到的不能下载依赖的问题解决方法

一、导入thymeleaf

idea中thymeleaf的导入非常简单,就是将thymeleaf依赖加入到pom.xml文件中即可。

1、Thymeleaf 官网:https://www.thymeleaf.org/

2、Thymeleaf 在Github 的主页:https://github.com/thymeleaf/thymeleaf

3、Spring官方文档:“https://docs.spring.io/spring-boot/docs/2.1.6.RELEASE/reference/htmlsingle/#using-boot-starter” 

上面这些是可以找到相对应thymeleaf文件的网址(我一般用第三个,下面也以第三个为例) 

idea怎样导入Thymeeaf模板引擎,以及遇到的不能下载依赖的问题解决方法

找到thymeleaf文件点击右边的pom文件即可,然后复制到自己项目的pom文件中

二、相关问题

有些人会遇到在pom文件中导入thymeleaf依赖时无法想在相应的jar包(jar包下载时爆红,不嫩那个下载的错误),这个是因为idea默认的镜像是在外国,一般进外国网站都比较慢,而且需要*,但是加入阿里云之后,就让idea去阿里云那边下载,阿里云网速快。 默认配置的网站速度慢。相关的方法如下:

idea怎样导入Thymeeaf模板引擎,以及遇到的不能下载依赖的问题解决方法

右键点击项目名,找到maven ,打开settings.xml

加入如下代码

<mirror>
    <id>nexus-aliyun</id>
    <mirrorOf>*</mirrorOf>
    <name>Nexus aliyun</name>
    <url>http://maven.aliyun.com/nexus/content/groups/public</url>
</mirror>

修改后就会下载很快啦。