<!-- 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>
备注
:bootclasspath标签中,若引入多个jar时中间需加分隔符,win下是‘;’,mac和linux下是‘:’,自动区分系统可使用变量${path.separator}