在开发过程中有这样的场景: java 后台服务通过jar 包 对外提供服务 ,通过IDEA 新建的 maven 项目 开发完成后 需要打包上传到服务器上运行,对于使用 SpringInitializr 项目习惯于使用提供的install 打包 的人来说 一次完成
下面就是通过 maven pom.xml 来配置 install 一键打包功能
pom.xml 的核心配置文件
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<archive>
<manifest>
<mainClass>com.xiucai.bi.bigdata.log.BootStart</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef> <!--试图该该descritorRef 打包时会报错--->
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>make-assembly</id> <!-- this is used for inheritance merges -->
<phase>package</phase> <!-- bind to the packaging phase -->
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>