转载地址:https://blog.youkuaiyun.com/yunfeng482/article/details/90232718
maven pom 配置 compile的web项目时指定/WEB-INF/lib 目录或者其他非maven仓库的jar作为额外的库目录,需要进行配置。
1、配置maven-compiler-plugin 中编译目录extdirs
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
<encoding>UTF-8</encoding>
<compilerArguments>
<extdirs>src\main\webapp\WEB-INF\lib</extdirs>
</compilerArguments>
</configuration>
</plugin>
2、通过dependency进行配置jar的系统目录systemPath
<dependency>
<groupId>com.go6d</groupId>
<artifactId>animate</artifactId>
<version>1.0.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/src/main/webapp/WEB-INF/lib/animate.jar</systemPath>
</dependency>
3、直接通过ide添加项目的外部jar依赖
4、通过把jar安装到本地maven仓库中再配置pom 依赖
1、把本地的jar报install到本地库
mvn install:install-file -Dfile=lucene-queryparser-4.6.1.jar -DgroupId=org.apache.lucene -DartifactId=lucene-queryparser -Dversion=4.6.1 -Dpackaging=jar
2、然后配置maven配置pom.xml文件
<!-- https://mvnrepository.com/artifact/org.apache.lucene/lucene-queryparser -->
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-queryparser</artifactId>
<version>4.6.1</version>
</dependency>
3、maven update项目,验证依赖是否添加到项目中