How to use third-party jar in idea's maven project

How to use third party jar in maven project


Use the following command

mvn install:install-file -Dfile=c:/abc.jar -DgroupId=com.lianlianpay -DartifactId=abc -Dversion=1.0.0 -Dpackaging=jar -DgeneratePom=true

-Dfile is the jar file to be transferred to the local repository.
After executing this command, a directory (com) will appear in the local repository (usually the $HOME/.m2 directory), under which there will be an abc-1.0.jar file and an automatically generated pom file.

Copy the following command into the pom file

<dependencies>
          <dependency>
          <groupId>com.lianlianpay</groupId>
          <artifactId>abc</artifactId>
          <version>1.0.0</version>
       </dependency>
    </dependencies>

If you are using an idea, you need to set it up in turn

Right-click on the project -> maven -> reimport
idea to configure the jar into the project.

If the jar is still not successfully imported in the above setting project, judge whether the jar paths configured in the local warehouse and the idea project are the same.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324922998&siteId=291194637