Two ways to import external jar packages in maven projects

method one

1. Add environment variables:

 MAVEN_HOME:(maven location)
 M2_HOME:(maven location)
 PATH:%M2_HOME%\bin
 (Verify whether maven is successfully configured cmd-->mvn -version (or mvn -v))

2. Install the SDK to the local warehouse

Put alipay-sdk-java20170307171631.jar under e: and enter e: in cmd and enter the following command:

mvn install:install-file -DgroupId=com.alipay -DartifactId=sdk-java -Dversion=20170307171631 -Dpackaging=jar -Dfile=alipay-sdk-java20170307171631.jar

 

3. Add in pom

<dependency>
    <groupId>com.alipay</groupId>
    <artifactId>sdk-java</artifactId>
    <version>20170307171631</version>
</dependency>

Method Two

1. Create a new lib directory under the main directory and copy the jar into it

2. Two places need to be configured in the pom file

 

<!-- 支付宝 -->
<dependency>
    <groupId>com.alipay</groupId>
    <artifactId>sdk-java</artifactId>
    <version

Guess you like

Origin blog.csdn.net/weixin_47385625/article/details/112765317