Springboot打包支持第三方jar


有時候我們需要的jar在maven里不存在,需要手動引入。比如,釘釘sdk

<dependency>
            <groupId>com.aliyun</groupId>
            <artifactId>taobao-sdk-java</artifactId>
            <version>1.0.0</version>
            <scope>system</scope>
            <systemPath>${project.basedir}/libs/taobao-sdk-java-auto_1479188381469-20180831.jar</systemPath>
</dependency>

springboot在打包的時候,調用spring-boot-maven-plugin,執行repackage把tomcat和resource,lib等合成一個新的jar。想要將系統jar打進去,必須配置includeSystemScope。最終會將lib放入BOOT-INF\lib

<build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <includeSystemScope>true</includeSystemScope>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>build-info</goal>
                            <goal>repackage</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM