发布时间: 阅读量

springboot 引用本地jar

springboot引用本地jar

1.在resources下新建目录lib然后把jar放进去
wei-xin-tu-pian-_20190815101857

2.在pom文件中加依赖

#前三个标签的内容可以自定义,关键是systemPath
<dependency>
            <groupId>com.github.jl</groupId>
            <artifactId>jxl</artifactId>
            <version>0.0.3</version>
            <scope>system</scope>
        <systemPath>${project.basedir}/src/main/resources/lib/jxl.jar</systemPath>
        </dependency>

3.想要此包打入最后的包中,还需再pom文件中添加如下配置

plugins>
    <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
            <source>1.8</source>
            <target>1.8</target>
            <encoding>UTF-8</encoding>
            <compilerArguments>
                <extdirs>${project.basedir}/src/main/resources/lib</extdirs>
            </compilerArguments>
        </configuration>
    </plugin>
</plugins>


参考