Dependency not found solution (Springboot, definitely works)

Problem Description

Today, when I was working on the dependencies of a project, the dependencies of easyexcel could not be downloaded, although my Maven configuration was fine.

  • rely:
      

  • Maven configuration:
      

I have switched several versions, but I can't download from the mirror, even if I turn on the accelerator, I can't download it from the default mirror.

solution

systemPath

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

Since it is not possible to download the jar package from the Internet, I will import the jar package locally, and the steps are as follows:

  1. https://mvnrepository.com/ website to download the required jar package

      

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

  3. Open the pom.xml file and modify the <dependency> configuration 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>
    
  4. Refresh Maven and successfully import

This solution may report: dependencyManagement.dependencies.dependency.systemPath' for com.alibaba:3.0.5:jar refers to a non-existing file,
then use mvn install

mvn install

  1. https://mvnrepository.com/ website to download the required jar package
      

  2. Install the local jar package to 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 the dependencies you downloaded are ok, you can directly use the above command. Just use the

    following command:

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

    Command description:

    • -Dfile= jar local absolute path
    • -DgroupId= groupId of the jar package
    • -DartifactId= the artifactId of the jar package
    • -Dversion= The version of the jar package
    • -Dpackaging= Packaging method
  3. Modify the <dependency> configuration:

                <dependency>
                    <groupId>com.alibaba</groupId>
                    <artifactId>easyexcel</artifactId>
                    <version>3.0.5</version>
                </dependency>
    
  4. Refresh Maven

Guess you like

Origin blog.csdn.net/m0_54355172/article/details/131138463