通过我们使用第三方依赖包时,为了避免其版本迭代问题,我们常规使用本地的包;但通常会出现加载本地jar无法打入项目里面;
我使用的本地方式是这样子的:
<dependency>
<groupId>com.alipay</groupId>
<artifactId>alipay-sdk-java20180104135026</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>D:/maven/repository/com/alipay/alipay-sdk-java20180104135026/1.0/alipay-sdk-java20180104135026-1.0.jar
</systemPath>
</dependency>
或者放到项目中:
<dependency>
<groupId>com.github.wxpay</groupId>
<artifactId>wxpay-sdk</artifactId>
<version>3.0.9</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/wxpay-sdk-3.0.9.jar</systemPath>
</dependency>
3.1版本的maven:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>UTF-8</encoding>
<compilerArgs>
<arg>-extdirs</arg>
<arg>${project.basedir}/src/lib</arg>
</compilerArgs>
</configuration>
</plugin>
老版本的maven
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>UTF-8</encoding>
<compilerArguments>
<extdirs>${project.basedir}/src/lib</extdirs>
</compilerArguments>
</configuration>
</plugin>