Maven 添加第三方jar包

Posted by 浮生 on 03-04,2020

maven 添加第三方jar包

<dependency>
	<groupId>com.km.studio</groupId>
	<artifactId>auth</artifactId>
	<version>1.0</version>
	<scope>system</scope>
	<systemPath>${project.basedir}/lib/auth.jar</systemPath>
</dependency>

${project.basedir} 代表项目根目录,即libsrc同级

jar方式打包第三方jar包

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

war方式打包第三方jar包

<build>
   <plugins>
       <plugin>
           <groupId>org.springframework.boot</groupId>
           <artifactId>spring-boot-maven-plugin</artifactId>
           <configuration>
               <includeSystemScope>true</includeSystemScope>
           </configuration>
       </plugin>
       <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-war-plugin</artifactId>
           <configuration>
               <webResources>
                   <resource>
                       <directory>lib</directory>
                       <targetPath>WEB-INF/lib/</targetPath>
                       <includes>
                           <include>**/*.jar</include>
                       </includes>
                   </resource>
               </webResources>
           </configuration>
       </plugin>
   </plugins>
</build>