解决项目中hbm文件用maven运行没有拷贝到target里面的问题

hbm文件都在src/main/java/com/test/ivd/cms/orm/pojo 目录下,但是运行maven test老报错误,经过检查发现hbm文件没有拷贝到target/classes目录中,在pom文件中增加如下内容

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-antrun-plugin</artifactId>
				<version>1.7</version>
				<executions>
					<execution>
						<id>prepare-hbm-copy</id>
						<phase>generate-resources</phase>
						<goals>
							<goal>run</goal>
						</goals>
						<configuration>
							<tasks>
								<copy todir="target/classes/com/test/ivd/cms/orm/pojo"
									overwrite="true">
									<fileset dir="src/main/java/com/test/ivd/cms/orm/pojo">
										<include name="**/*.hbm.xml" />
									</fileset>
								</copy>
							</tasks>
						</configuration>
					</execution>
				</executions>
			</plugin>


你可能感兴趣的:(maven)