用户工具

站点工具


分享:技术:maven:maven_resources_plugin

这是本文档旧的修订版!


maven-resources-plugin插件介绍和使用

maven-resources-plugin插件介绍

maven构建项目默认不会拷贝xml和properties文件,只会编译java文件成class文件并拷贝到target目录下,所以需要maven-resources-plugin插件来拷贝相关资源

maven-resources-plugin插件使用

<plugins>
	<!-- 拷贝资源插件 -->
	<plugin>
		<groupId>org.apache.maven.plugins</groupId>
		<version>2.5</version>
		<artifactId>maven-resources-plugin</artifactId>
		<configuration>
			<encoding>UTF-8</encoding>
		</configuration>
		<executions>
			<execution>
				<id>copy-xmls</id>
				<phase>process-sources</phase>
				<goals>
					<goal>copy-resources</goal>
				</goals>
				<configuration>
					<overwrite>true</overwrite>
					<outputDirectory>${basedir}/target/classes/</outputDirectory>
					<resources>
						<resource>
							<directory>${basedir}/src/main/java/</directory>
							<includes>
								<include>*.xml</include>
							</includes>
						</resource>
					</resources>
				</configuration>
			</execution>
		</executions>
	</plugin>
</plugins>
分享/技术/maven/maven_resources_plugin.1436777023.txt.gz · 最后更改: 2015/07/13 16:43 由 gxx