---
title: "Maven编译打包出错：找不到符号"
author: "henu_zhangyang"
date: "2016-08-24T13:57:24Z"
tags: ["maven"]
categories: ["开源软件"]
slug: "maven"
draft: false
lastmod: "2016-09-14T10:40:31Z"
id: 2319907
url: "https://ihenu.iteye.com/blog/2319907"
---

项目中，使用的是maven管理，但是有几个jar不是通过maven引入的，是通过IDEA导入的，在使用maven插件编译的时候，会出现如下的一些错误：

   
![](http://dl2.iteye.com/upload/attachment/0119/5566/eb3be3ce-8033-3119-a824-c89aa4cd38dc.jpg)  
 

 

解决方法：

在项目中创建一个目录lib,然后将jar复制到该文件夹下，最后在maven编译插件中配置如下

 

 

```
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                    <encoding>UTF-8</encoding>
                    <!-- 这里是新添加的-->
                    <compilerArguments>
                        <!-- 对应jar放置在项目中的位置-->
                        <extdirs>lib</extdirs>
                    </compilerArguments>
                </configuration>
            </plugin>
```