示例工程:SpringBoot + Maven
1.使用SpringBoot自带插件
pom.xml文件中添加如下代码:
(代码不设置行号,方便后续拷贝。)
<build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> <!-- 工程主入口--> <mainClass>com.gannalyo.plugin.MySampleMavenPackagePluginApplication</mainClass> </configuration> <executions> <execution> <goals> <goal>repackage</goal> </goals> </execution> </executions> </plugin> </plugins> </build>