天天看点

SpringBoot项目 Maven项目依赖外部jar进行打包

在pom.xml中通过以下方式引入lib中的每个依赖

如果在根目录下 ${project.basedir}/lib/。。。。。。
<dependency>
  <groupId>com.beeb</groupId>
  <artifactId>test</artifactId>
  <version>1.0.0</version>
  <scope>system</scope>
  <systemPath>${project.basedir}/lib/commons-cxxxx.jar</systemPath>
</dependency>
 
如果是是在某个模块下 ${pom.basedir}/../:lib/
<dependency>
  <groupId>com.beeb</groupId>
  <artifactId>test</artifactId>
  <version>1.0.0</version>
  <scope>system</scope>
  <systemPath>${pom.basedir}/../lib/commons-cxxxx.jar</systemPath>
</dependency>
...
           

groupId和artifactId可以随便填,注意artifactId 不能重复

在pom文件加上这个

<plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <configuration>
                <includeSystemScope>true</includeSystemScope>
            </configuration>
        </plugin>
           

参考文献:https://blog.csdn.net/abcwanglinyong/article/details/90448497