Created
May 22, 2014 06:29
-
-
Save yufan-liu/8a34608404e25f203523 to your computer and use it in GitHub Desktop.
Maven dependencies to lib folder
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<build> | |
<resources> | |
<resource> | |
<directory>${pom.basedir}/src/main/resources</directory> | |
</resource> | |
</resources> | |
<testResources> | |
<testResource> | |
<directory>${pom.basedir}/src/test/resources</directory> | |
</testResource> | |
</testResources> | |
<plugins> | |
<!-- 把依赖的jar包拷到lib目录下 --> | |
<plugin> | |
<groupId>org.apache.maven.plugins</groupId> | |
<artifactId>maven-dependency-plugin</artifactId> | |
<executions> | |
<execution> | |
<id>copy-dependencies</id> | |
<phase>package</phase> | |
<goals> | |
<goal>copy-dependencies</goal> | |
</goals> | |
<configuration> | |
<outputDirectory>${project.build.directory}/lib</outputDirectory> | |
<overWriteReleases>false</overWriteReleases> | |
<overWriteSnapshots>false</overWriteSnapshots> | |
<overWriteIfNewer>true</overWriteIfNewer> | |
</configuration> | |
</execution> | |
</executions> | |
</plugin> | |
<!-- 以utf-8编码拷贝配置文件,拷贝过程中是可以做变量替换的,也就是说你的配置文件可以是个模板,里面的${}所包含的内容是可以拷贝过程中替换的 --> | |
<plugin> | |
<groupId>org.apache.maven.plugins</groupId> | |
<artifactId>maven-resources-plugin</artifactId> | |
<version>2.3</version> | |
<executions> | |
<execution> | |
<id>copy-resources</id> | |
<phase>package</phase> | |
<goals> | |
<goal>copy-resources</goal> | |
</goals> | |
<configuration> | |
<encoding>UTF-8</encoding> | |
<outputDirectory>${project.build.directory}</outputDirectory> | |
<!-- 把配置文件拷到和jar包同一个路径下 --> | |
<resources> | |
<resource> | |
<directory>src/main/resources/</directory> | |
<includes> | |
<include>log4j.properties</include> | |
</includes> | |
<filtering>true</filtering> | |
</resource> | |
</resources> | |
</configuration> | |
</execution> | |
</executions> | |
</plugin> | |
<!-- 打jar包时需要把配置文件给排除在外 --> | |
<plugin> | |
<groupId>org.apache.maven.plugins</groupId> | |
<artifactId>maven-jar-plugin</artifactId> | |
<executions> | |
<execution> | |
<phase>package</phase> | |
<goals> | |
<goal>jar</goal> | |
</goals> | |
<configuration> | |
<classifier>lib</classifier> | |
<excludes> | |
<exclude>log4j.properties</exclude> | |
</excludes> | |
</configuration> | |
</execution> | |
</executions> | |
</plugin> | |
</plugins> | |
</build> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment