maven打包包含本地jar包

2021-03-30 17:07
32
0

添加依赖

1、groupId随便填
2、artifactId随便填
3、version随便填
4、scope填system
5、systemPath填jar包路径,${project.basedir}为当前项目路径

<dependency>
   <groupId>xxx</groupId>
   <artifactId>aaa</artifactId>
   <version>1.0.3</version>
   <scope>system</scope>
   <systemPath>${project.basedir}/libs/xxx/aaa.jar</systemPath>
</dependency>

添加插件

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

添加包含jar包

<resources>
  <resource>
    <directory>lib</directory>
    <targetPath>/BOOT-INF/lib/</targetPath>
    <includes>
      <include>**/*.jar</include>
    </includes>
  </resource>
</resources>

全部评论