maven 打包成单个jar 包, pom.xml 中build 节点完整代码如下 :
<build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <version>2.3.12.RELEASE</version> <configuration> <includeSystemScope>true</includeSystemScope> </configuration> <executions> <execution> <goals> <goal>repackage</goal> </goals> </execution> </executions> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <version>3.4.2</version> <configuration> <archive> <manifestEntries> <Class-Path>resources/</Class-Path> </manifestEntries> </archive> <excludes> <exclude>*.yml</exclude> <exclude>*.xml</exclude> </excludes> </configuration> </plugin> <plugin> <artifactId>maven-resources-plugin</artifactId> <version>3.3.1</version> <executions> <execution> <id>copy-dependencies</id> <phase>package</phase> <goals> <goal>copy-resources</goal> </goals> <configuration> <outputDirectory>${project.build.directory}/resources</outputDirectory> <resources> <resource> <directory>src/main/resources</directory> </resource> </resources> </configuration> </execution> </executions> </plugin> </plugins> </build>
本博客是自己在学习和工作途中的积累与总结,仅供自己参考,也欢迎大家转载,转载时请注明出处。
浙公网安备 33010602011771号