做个记录
通常情况下我们的项目通过mvn clean install
命令进行打包编译,然后生成的jar包在target目录下,下面代码可以直接指定到具体的目录输出:
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>copy</id>
<phase>package</phase>
<configuration>
<tasks>
<!-- <copy todir="D:\develop\idea_workspace\demo">-->
<copy todir="${project.basedir}">
<fileset dir="${project.build.directory}">
<include name="${project.artifactId}-${project.version}.jar" />
</fileset>
</copy>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
主要是标签,将target下的目录拷贝到其他目录下
${project.basedir}
:表示当前项目根目录
结果如下: