maven引入放在了WEB-INF/lib目录下的jar包

时间:2023-01-21 09:09:11

配置pom.xml文件:

!更好的方式是配置编译参数<compilerArguments>,添加extdirs将jar包相对路径添加到配置中,如下:

<build>
        <plugins>
            <plugin>
              <artifactId>maven-compiler-plugin</artifactId>
              <configuration>
                  <source>1.6</source>
                  <target>1.6</target>
                  <encoding>UTF-8</encoding>
                  <compilerArguments>
                   <extdirs>src\main\webapp\WEB-INF\lib</extdirs>
                 </compilerArguments>
              </configuration>
            </plugin>
        </plugins>
    </build>

注意:路径