maven 排除依赖jar包

这样就可以添加dependency而不需要再将WEB-INF/lib目录下的jar包安装到本地库中了。 
具体配置录下: 
Xml代码 
<dependency> 
<groupId>org.apache</groupId> 
<artifactId>test</artifactId> 
<version>1.0</version> 
<scope>system</scope> 
<systemPath>${basedir}/src/main/webapp/WEB-INF/lib/paypal_base.jar</systemPath> 
</dependency> 

!更好的方式是配置编译参数<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>

猜你喜欢

转载自blog.csdn.net/jackliuy/article/details/53811598