<!-- 把依赖的jar包拷到lib目录下 -->

02	<plugin>
03	    <groupId>org.apache.maven.plugins</groupId>
04	    <artifactId>maven-dependency-plugin</artifactId>
05	    <executions>
06	        <execution>
07	            <id>copy-dependencies</id>
08	            <phase>package</phase>
09	            <goals>
10	                <goal>copy-dependencies</goal>
11	            </goals>
12	            <configuration>
13	                <outputDirectory>${project.build.directory}/lib</outputDirectory>
14	                <overWriteReleases>false</overWriteReleases>
15	                <overWriteSnapshots>false</overWriteSnapshots>
16	                <overWriteIfNewer>true</overWriteIfNewer>
17	            </configuration>
18	        </execution>
19	    </executions>
20	</plugin>
21	<!-- 以utf-8编码拷贝配置文件,拷贝过程中是可以做变量替换的,也就是说你的配置文件可以是个模板,里面的${}所包含的内容是可以拷贝过程中替换的 -->
22	<plugin>
23	    <groupId>org.apache.maven.plugins</groupId>
24	    <artifactId>maven-resources-plugin</artifactId>
25	    <version>2.3</version>
26	    <executions>
27	        <execution>
28	            <id>copy-resources</id>
29	            <phase>package</phase>
30	            <goals>
31	                <goal>copy-resources</goal>
32	            </goals>
33	            <configuration>
34	                <encoding>UTF-8</encoding>
35	                <outputDirectory>${project.build.directory}</outputDirectory><!-- 把配置文件拷到和jar包同一个路径下 -->
36	                <resources>
37	                    <resource>
38	                        <directory>src/main/resources/</directory>
39	                        <includes>
40	                            <include>config.xml</include>
41	                            <include>log4j.xml</include>
42	                        </includes>
43	                        <filtering>true</filtering>
44	                    </resource>
45	                </resources>
46	            </configuration>
47	        </execution>
48	    </executions>
49	</plugin>
50	<!-- 打jar包时需要把配置文件给排除在外 -->
51	<plugin>
52	    <groupId>org.apache.maven.plugins</groupId>
53	    <artifactId>maven-jar-plugin</artifactId>
54	    <executions>
55	        <execution>
56	            <phase>package</phase>
57	            <goals>
58	                <goal>jar</goal>
59	            </goals>
60	            <configuration>
61	                <classifier>lib</classifier>
62	                <excludes>
63	                    <exclude>config.xml</exclude>
64	                    <exclude>log4j.xml</exclude>
65	                </excludes>
66	            </configuration>
67	        </execution>
68	    </executions>
69	</plugin>