maven对项目进行打包之后,可以将打包好的jar和某些资源文件复制到指定位置,例如你的项目结构是services父项目下有个子项目,service-1,它在打包之后,希望把jar和templates文件夹复制到父项目services的target目录,这就可以使用maven的两个插件来完成。
maven-dependency-plugin
编译之后,将当前项目的jar复制到某个目录下
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>${project.groupId}</groupId>
<artifactId>${project.artifactId}</artifactId>
<version>${project.version}</version>
</artifactItem>