springboot打包问题

pom.xml

<build>
		<plugins>
			<plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
				<configuration>
					<executable>true</executable>
				</configuration>
				<executions>
					<execution>
						<goals>
							<goal>repackage</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
		</plugins>
</build>
[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.2.1.RELEASE:repackage (default) on project demo-common: Execution default of
goal org.springframework.boot:spring-boot-maven-plugin:2.2.1.RELEASE:repackage failed: Unable to find main class -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <goals> -rf :demo-common


错误原因就是没有找到main方法,整个demo-common没有启动入口。

但是它作为核心依赖jar包,又没有参与业务,所以没有给它提供main方法的启动类。

解决办法:
去掉当前项目pom中的spring-boot-maven-plugin插件

spring-boot-maven-plugin用于给jar将依赖的第三方jar打包到当前jar中

注:
继承spring-boot-starter-parent的springboot项目不用添加主类和设置repackage

https://www.baidu.com/link?url=jyRu_B0z-XhN69mUmTDDJC4p1dOnk8IxODdcj5465c5F9jLc2GtDJ12DPk7GORg9&wd=&eqid=eeb204500021c96d000000045de8ac9a

posted @ 2019-12-06 19:02  guardWei  阅读(590)  评论(0编辑  收藏  举报