当我们需要引用本地jar包的时候,往往采用的时候以下方法
<dependency>
<groupId>com.wong</groupId>
<artifactId>smart</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>目标jar包路径</systemPath>
</dependency>
但是因为scope中填写的是system的原因,编译器在编译的时候,是不会默认把这类jar包复制到war中,因此我们需要在pom在做一些修改才可以。
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.2</version>
<configuration>
<webResources>
<resources>
<!-- 源文件夹 -->
<directory>lib/</directory>
<targetPath>WEB-INF/lib</targetPath>
<includes>
<include>*.jar</include>
</includes>
</resources>
</webResources>
</configuration>
</plugin>