报错

当你在pom.xml中加tomcat8-maven-plugin插件时会发现报

Could not find artifact org.apache.tomcat.maven:tomcat8-maven-plugin:pom:in nexus-aliyun

原因

因为在阿里云镜像中找不到该插件,在Maven的中央仓库中也没有找到tomcat8-maven-plugin的plugin

解决方法

看了许多教程都是让你去重新配置镜像,或者是让你去官网下载然后导进项目中,但是我们既然用了maven就是为了减少手动导入的麻烦。所以我们需要使用Maven中plugin的Repositories这个是用来配置插件地址的,因为maven的所有功能都是使用插件来实现功能的,因此需要从特定的地址下载插件包,在pom.xml中加入下面的代码即可,因为是外网所以下载会很慢,但是能成功解决找不到插件问题。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<pluginRepositories>
<pluginRepository>
<id>alfresco-public</id>
<url>https://artifacts.alfresco.com/nexus/content/groups/public</url>
</pluginRepository>
<pluginRepository>
<id>alfresco-public-snapshots</id>
<url>https://artifacts.alfresco.com/nexus/content/groups/public-snapshots</url>
<snapshots>
<enabled>true</enabled>
<updatePolicy>daily</updatePolicy>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>beardedgeeks-releases</id>
<url>http://beardedgeeks.googlecode.com/svn/repository/releases</url>
</pluginRepository>
</pluginRepositories>