问题概述
笔者学习maven过程中创建项目,中途引入了一些第三方jar包,并未通过依赖进行引入,结果在mvn clean compile编译时老提示失败,查看失败信息都是找不到第三方的jar,于是记录下解决方式
在pom.xml中添加如下配置
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>UTF-8</encoding>
<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>
</plugin>
其中最后一个arg标签填写你导入的第三方jar包的路径,让插件扫描到,亲测解决