Dependency not found solution (Springboot, absolutely effective)

Table of contents

  • Problem Description
  • solution
    • systemPath
  • mvn install

Problem Description

When I was working on the dependencies of a project today, the dependencies of easyexcel just couldn't be downloaded, although my Maven configuration was fine.

  • rely:
      

  • Maven configuration:
      

I switched several versions, but still couldn't download from the mirror. I even turned on the accelerator and switched back to the default mirror to download.

solution

systemPath

This solution is relatively simple. If this solution reports an error, use the following solution.

Since downloading the jar package online does not work, I will introduce the jar package locally. The steps are as follows:

  1. Download the required jar package from the https://mvnrepository.com/ website

  

  1. Create a new lib folder in the project root directory (of course, you can choose any name) and put the downloaded jar package into it.

  2. Open the pom.xml file and modify The configuration is as follows:

     <dependency>
                    <groupId>com.alibaba</groupId>
                    <artifactId>3.0.5</artifactId>
                    <version>{easyexcel.version}</version>
                    <scope>system</scope>
                    <systemPath>{project.basedir}/lib/easyexcel-3.0.5.jar</systemPath>
                </dependency> 
    
  3. Refresh Maven and import successfully

This plan may report:

  1. dependencyManagement.dependencies.dependency.systemPath’ for com.alibaba:3.0.5:jar refers to a non-existing file
    Then use the mvn install solution
  2. If it still reports that the jar package cannot be found during clean/build/package, you can change {project.basedir} to{pom.basedir}

mvn install

Note: Be sure to add "" to the command value, otherwise an error will be reported:
Thanks to Xiaoxiaocaisnail for the reminder. When I wrote the article before, I didn’t add “” to prevent errors. It may be because I changed the terminal to gitBash![](https://www.cacacs.com/wp-content/uploads /2024/07/8f8954dc2fd14305a543173901c26c3c.png)

  1. Download the required jar package from the https://mvnrepository.com/ website
      

  2. Install the local jar package into the Maven repository:

    mvn install:install-file -Dfile="D:\Applications\MyRepository\easyexcel-3.0.5.jar" 
    

If an error is reported: Under normal circumstances, as long as there is no problem with the dependencies you downloaded, just use the above command.

Just use the following command:

```d
mvn install:install-file -Dfile="D:\Applications\MyRepository\easyexcel-3.0.5.jar" -DgroupId="com.alibaba" -DartifactId="easyexcel" -Dversion="3.0.5" -Dpackaging="jar" 
```

Instruction description:

  • -Dfile= The absolute path of jar in local area
  • -DgroupId= groupId of jar package
  • -DartifactId= artifactId of jar package
  • -Dversion= jar package version
  • -Dpackaging= packaging method
  1. Modification Configuration:
     <dependency>
                    <groupId>com.alibaba</groupId>
                    <artifactId>easyexcel</artifactId>
                    <version>3.0.5</version>
                </dependency> 
    
  2. Refresh Maven