一般情况下jar包都可以使用pom.xml来配置管理,但也有一些时候,
我们项目中使用了一个内部jar文件,但是这个文件我们又没有开放到maven库中.
我们会将文件当到我们项目WEB-INF/lib中
如果我们不对pom.xml进行特殊配置的话,maven打包是不会自动去引用和编译lib中的jar文件的,
所以需要我们修改下pom.xml文件
注意3.1版本之后 不要使用compilerArguments 官方已经标记为过时了 建议使用compilerArgs即可.
<!--
配置
一般情况下jar包都可以使用pom.xml来配置管理,但也有一些时候,
我们项目中使用了一个内部jar文件,但是这个文件我们又没有开放到maven库中.
我们会将文件当到我们项目WEB-INF/lib中
如果我们不对pom.xml进行特殊配置的话,maven打包是不会自动去引用和编译lib中的jar文件的,
所以需要我们修改下pom.xml文件
-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<compilerArgs>
<arg>-verbose</arg>
<arg>-Xlint:unchecked</arg>
<arg>-Xlint:deprecation</arg>
<arg>-bootclasspath</arg>
<arg>${env.JAVA_HOME}/jre/lib/rt.jar</arg>
<arg>-extdirs</arg>
<arg>${project.basedir}/src/main/webapp/WEB-INF/lib</arg>
</compilerArgs>
</configuration>
<!-- 3.1 版本之前的配置 -->
<!-- <configuration>-->
<!-- <compilerArguments>-->
<!-- <exdirs>${project.basedir}/src/main/webapp/WEB-INF/lib</exdirs>-->
<!-- </compilerArguments>-->
<!-- </configuration>-->
</plugin>