springboot引入第三方jar方式,使用scope:system配置systemPath编译,不用添加到本地仓库!

若是springmvc项目可参考:https://www.cnblogs.com/007sx/p/12439620.html

项目三方jar存放位置结构:

 

 

pom.xml中引入三方jar:

<dependency>
    <groupId>test</groupId>
    <artifactId>testa</artifactId>
    <version>0.0.1</version>
    <scope>system</scope>
    <systemPath>${project.basedir}/src/main/resources/lib/test.jar</systemPath>
</dependency>

pom.xml中的打包构建配置:

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <configuration>
                <includeSystemScope>true</includeSystemScope>
                <!-- 是否限制解压缩 -->
                <executable>false</executable>
                <mainClass>com.tuijie.gainguest.GainguestApplication</mainClass>
            </configuration>
            <executions>
                <execution>
                    <goals>
                        <goal>repackage</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
    <resources>
        <!-- 用于排除三方jar包打包进入BOOT-INF/classes下(运行时是用不到的) -->
        <resource>
            <directory>src/main/resources</directory>
            <filtering>false</filtering>
            <excludes>
                <exclude>lib/*.jar</exclude>
            </excludes>
        </resource>
    </resources>
</build>

重点:

<includeSystemScope>true</includeSystemScope>
<excludes>
    <exclude>lib/*.jar</exclude>
</excludes>

 

posted @ 2020-03-08 14:04  007少侠  阅读(7589)  评论(0编辑  收藏  举报
友情链接:便宜vps(CN2GIA线路)
站长统计: