在pom.xml中添加如下代码

<build>

                   <!-- 配置了很多插件 -->

                   <plugins>

                            <plugin>

                                     <groupId>org.apache.maven.plugins</groupId>

                                     <artifactId>maven-compiler-plugin</artifactId>

                                     <version>3.5.1</version>

                                     <configuration>

                                               <source>1.7</source>

                                               <target>1.7</target>

                                               <encoding>UTF-8</encoding>

                                     </configuration>

                            </plugin>

                   </plugins>

         </build>