1.在src下面建lib文件夹将第三方jar包放到里面;
2.在configure build path中添加jar;
3.开发时候,注销掉下面配置, 打包jar包的时候需要放开注释
4.打包命令:mvn clean package
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.test</groupId>
<artifactId>taobao-ke-api</artifactId>
<version>1.0.0</version>
<packaging>jar</packaging>
<name>taobao-ke-api</name>
<description></description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.1.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.28</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.4.1</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>4.4.1</version>
</dependency>
<!--第三方依赖 打包jar包的时候需要放开-->
<!-- <dependency>
<groupId>com.taobao</groupId>
<artifactId>sdk-java</artifactId>
<scope>system</scope>
<version>1521597375478-20180411</version>
<systemPath>${basedir}/src/lib/taobao-sdk-java-auto_1521597375478-20180411.jar</systemPath>
</dependency>
<dependency>
<groupId>com.joy</groupId>
<artifactId>joy-infra-client</artifactId>
<scope>system</scope>
<version>1.0.0-SNAPSHOT</version>
<systemPath>${basedir}/src/lib/test-infra-client-1.0.0-SNAPSHOT.jar</systemPath>
</dependency>-->
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>UTF-8</encoding>
<compilerArguments>
<extdirs>${basedir}/src/lib</extdirs>
</compilerArguments>
</configuration>
</plugin>
</plugins>
<!--打包jar包的时候需要放开-->
<!-- <resources>
<resource>
<directory>src/lib</directory>
<targetPath>BOOT-INF/lib/</targetPath>
<includes>
<include>**/*.jar</include>
</includes>
</resource>
<resource>
<directory>src/main/resources</directory>
<targetPath>BOOT-INF/classes/</targetPath>
</resource>
</resources> -->
</build>
</project>
网友评论