<!-- 1.添加对工程lib目录中jar的编译 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>UTF-8</encoding>
<compilerArguments>
<extdirs>${project.basedir}/src/main/resources/lib</extdirs>
</compilerArguments>
</configuration>
</plugin>
<!-- 2.编译时引入独立jar包 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>UTF-8</encoding>
<compilerArguments>
<verbose />
<!-- 替换为所引用jar的路径 -->
<bootclasspath>${JAVA_HOME}\jre\lib\rt.jar</bootclasspath>
</compilerArguments>
</configuration>
</plugin>
也可以使用下面的方式
<dependency>
<groupId>com.example</groupId>
<artifactId>your-artifact-id</artifactId>
<version>1.0.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/libs/your-jar-file.jar</systemPath>
</dependency>