两种代码:有时候有一种不管用
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>copy</id>
<phase>package</phase>
<configuration>
<target>
<!-- 存放的文件夹 只需要改这里就行-->
<copy todir="d:/Rod/毕设/微服务jar包">
<fileset dir="${project.build.directory}">
<include name="${project.artifactId}-${project.version}.jar"/>
</fileset>
</copy>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<id>install</id>
<phase>install</phase>
<configuration>
<target>
<mkdir dir="${basedir}/target/classes"/>
<!-- 存放的文件夹 只需要改这里就行-->
<copy todir="d:/Rod/毕设/微服务jar包" overwrite="true">
<fileset dir="${project.build.directory}"
erroronmissingdir="false">
<include name="*.jar"/>
</fileset>
</copy>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>