Solution to maven dependency not found: manual download, multi-mirror import.

The maven central warehouse is far away from the country and has not been downloaded. Due to network reasons, it has been delayed in downloading, so we need to configure some domestic mirror warehouses to download the jar package. However, Alibaba's warehouse does not contain all the jar packages in the central warehouse, so some of our jar packages cannot be downloaded and become popular.

To integrate information on the Internet, you can consider several methods:

1. Manually download the central warehouse jar package and import the maven library

For example: we want to download:

A Download: Visit: Maven Repository: Search/Browse/Explore (mvnrepository.com)

Find the version number of the corresponding package and click to download. 

BDownload: Visit:  Central Repository: (maven.org)

search:

 Then find: com.alibaba.easyexcel.3.0.5 version.

Download. 

Import maven repository:

cmd, in the current jar package directory, enter the console (I have already done this.)

 Enter the following commands.

mvn install:install-file -Dfile=easyexcel-3.0.5.jar -DgroupId=com.alibaba -DartifactId=easyexcel -Dversion=3.0.5 -Dpackaging=jar

 -Dfile: jar包文件名
 -DgroupId: groupId
 -DartifactId: artifactId
 -Dversion: 版本号

This is the path where your jar package file is generated. You need to copy and paste it into your own maven repository. We can use it normally.

2. Multiple mirror complementary configurations

Our Alibaba Cloud is the first to bear the brunt. As the first image, it only serves as the proxy for the first central warehouse.

The second mirror configuration can proxy all maven repositories starting with https:*.

	<mirror>
		<id>aliyunmaven</id>
		<mirrorOf>central</mirrorOf>
		<name>阿里云公共仓库</name>
		<url>https://maven.aliyun.com/repository/public</url>
	</mirror>

	<mirror>
      <id>maven-default-http-blocker</id>
      <mirrorOf>external:https:*</mirrorOf>
      <name>Pseudo repository to mirror external repositories initially using HTTP.</name>
      <url>http://0.0.0.0/</url>
      <blocked>true</blocked>
	</mirror>

3. Possible problems encountered.

You have the local jar package, but still get an error? Delete your IDEA cache and restart IDEA.

Guess you like

Origin blog.csdn.net/Qhx20040819/article/details/132759498