spring boot2 引用本地jar包開發(fā)和打包注意事項(xiàng)

1.在src下面建lib文件夾將第三方j(luò)ar包放到里面;
2.在configure build path中添加jar;
3.開發(fā)時(shí)候,注銷掉下面配置, 打包jar包的時(shí)候需要放開注釋
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包的時(shí)候需要放開-->
    <!--  <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包的時(shí)候需要放開-->
    <!-- <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>

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • 1 為什么使用Maven這樣的構(gòu)建工具 【W(wǎng)hy】 1.1 一個(gè)項(xiàng)目就是一個(gè)工程 如果項(xiàng)目非常...
    coder_girl閱讀 522評(píng)論 0 1
  • 一、為什么使用Maven這樣的構(gòu)建工具【why】 ① 一個(gè)項(xiàng)目就是一個(gè)工程 如果項(xiàng)目非常龐大,就不適合使用pack...
    問題_解決_分享_討論_最優(yōu)閱讀 1,303評(píng)論 0 16
  • Maven編譯代碼的相關(guān)命令 第一、main目錄下的主代碼編寫完畢后,使用Maven進(jìn)行編譯,在項(xiàng)目根目錄下運(yùn)行命...
    加油小杜閱讀 1,436評(píng)論 0 2
  • 轉(zhuǎn)載:http://blog.csdn.net/u012562943/article/details/504611...
    raincoffee閱讀 2,309評(píng)論 0 1
  • 想要逃離,想要陌生又新鮮的空氣。 周五下班后出發(fā),周六在另一個(gè)城市醒來,開始新的一天。等到下午沒有什么地方可以逛了...
    夢(mèng)未央Almost閱讀 426評(píng)論 0 2

友情鏈接更多精彩內(nèi)容