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依赖

Maven pom文件配置非仓库的jar依赖(如:web app中的/WEB-INF/lib)

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项目,验证依赖是否添加到项目中

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-04-30
  • 2021-07-16
  • 2021-06-27
  • 2021-08-23
  • 2021-06-29
猜你喜欢
  • 2021-05-27
  • 2021-06-30
  • 2021-11-09
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案