异常信息
Could not find artifact com.aspose:aspose-words:pom:18.10 in central (https://repo.maven.apache.org/maven2)
解决办法
在pom包内配置:
<dependency>
<groupId>com.aspose</groupId>
<artifactId>aspose-words</artifactId>
<version>18.10</version>
</dependency>
pom中增加如下配置,把配置的其它仓库注释掉,先下载这个包
<repositories>
<repository>
<id>aspose-maven-repository</id>
<url>https://artifact.aspose.com/repo/</url>
</repository>
</repositories>
又出现问题
Blocked mirror for repositories: [aspose-maven-repository (http://artifact.aspose.com/repo/, default, releases+snapshots)]
错误原因是因为Maven在升级到3.8.1以后,从安全角度考虑,默认将非https的远端仓库屏蔽掉了。
解决方案:
- 把Maven版本降到3.8.1以下
- 让远端仓库支持https,将镜像仓库从http 变成https
- 为每一个非http源增加如下mirror配置(源比较多的话会比较麻烦)
<mirror> <id>insecure-repo</id> <mirrorOf>external:http:*</mirrorOf> <url>http://www.ebi.ac.uk/intact/maven/nexus/content/repositories/ebi-repo/</url> <blocked>false</blocked> </mirror>
-
注释掉 $MAVEN_HOME/conf/settings.xml 中的拦截标签
找到你IDEA中指定的settings.xml配置文件,注释掉如下配置即可:
<mirror> <id>maven-default-http-blocker</id> <mirrorOf>external:http:*</mirrorOf> <name>Pseudo repository to mirror external repositories initially using HTTP.</name> <url>http://0.0.0.0/</url> <blocked>true</blocked> </mirror>
- 使用dummy镜像覆盖掉默认配置中的镜像配置(这也是我最喜欢的方法)。在~/.m2/settings.xml中添加如下mirror配置
<mirror>
<id>maven-default-http-blocker</id>
<mirrorOf>external:dummy:*</mirrorOf>
<name>Pseudo repository to mirror external repositories initially using HTTP.</name>
<url>http://0.0.0.0/</url>
<blocked>true</blocked>
</mirror>