zoukankan      html  css  js  c++  java
  • 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

  • 相关阅读:
    python第22天作业
    python之常见模块(一)
    python之包和文件目录规范
    python第20天作业
    python之模块
    python之匿名函数
    Python算法之二分法
    间间间间简陋版书城系统
    python第十九天作业
    4-1作业
  • 原文地址:https://www.cnblogs.com/zhangww/p/11989541.html
Copyright © 2011-2022 走看看