---
title: "maven小技巧"
author: "nully"
date: "2016-01-23T10:58:14Z"
tags: []
categories: ["研发管理"]
slug: "maven"
draft: false
lastmod: "2016-01-23T10:58:14Z"
id: 2273471
url: "https://nully.iteye.com/blog/2273471"
---

1.在项目使用maven进行构建时，对于在本地上的jar包没有上传到maven库中，常用的办法是放到webapp/WEB-INF/lib目录下，但是在最后进行项目打包时就会报错，可以通过以下配置解决：

```java

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>2.5.1</version>
    <configuration>
        <source>1.7</source>
	<target>1.7</target>
	<compilerArgument>-Xlint:all</compilerArgument>
	<showWarnings>true</showWarnings>
	<showDeprecation>true</showDeprecation>
	<compilerArguments>
            <extdirs>src\main\webapp\WEB-INF\lib</extdirs>
        </compilerArguments>
    </configuration>
</plugin>

```


2.对于某些不想进行打包的目录可以进行过滤，配置如下：

```java

<plugin>
    <artifactId>maven-war-plugin</artifactId>
    <version>2.1.1</version>
    <configuration>
        <packagingExcludes>WEB-INF/web.xml</packagingExcludes>
	<warSourceExcludes>sql/**</warSourceExcludes>
    </configuration>
</plugin>

```