maven 中 scope标签的作用以及引入本地jar包打包方法
1. scope标签的作用
2、使用system标签
项目三方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>