1、我们正常项目打包是把jar打到一个jar中,但是我们要把jar打包到别的文件夹中,需要这么设置打包配置:
<plugins>
<!-- java编译插件 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>outjar/</classpathPrefix>
<!-- 程序入口类的全路径 -->
<mainClass>com.zjh.test.TestApplication</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy</id>
<phase>install</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/outjar</outputDirectory><!-- 打包后的输出位置 -->
</configuration>
</execution>
</executions>
</plugin>
</plugins>
然后还可以设置打包后的报名,在pom文件<build>中添加<finalName>test-parent-project</finalName>就可以了