spring boot打包时Unable to find a single main class的解决方法
2017-08-07 21:38
931 查看
最近团队开始开发一个新产品,leader是转岗过来的,他们原来的团队用的都是Spring boot,所以新的项目抛弃了原来使用的jetty,创建这个工程的RD也是他带过来的,不过一过来就给我挖了个坑。
他创建的工程,我开发RPC接口,但是他创建的时候pom中缺少了一个配置,导致我在deploy的时候出现一下异常:
[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:1.3.6.RELEASE:repackage (default) on project quickpass-trafficcard-common: Execution default of goal org.springframework.boot:spring-boot-maven-plugin:1.3.6.RELEASE:repackage
failed: Unable to find main class -> [Help 1]
根据http://www.jianshu.com/p/b521f819b06a里的方法解决了这个问题。
就是在pom文件新增一个配置,其中start-class为你的启动类
这样就可以正常打包了。
他创建的工程,我开发RPC接口,但是他创建的时候pom中缺少了一个配置,导致我在deploy的时候出现一下异常:
[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:1.3.6.RELEASE:repackage (default) on project quickpass-trafficcard-common: Execution default of goal org.springframework.boot:spring-boot-maven-plugin:1.3.6.RELEASE:repackage
failed: Unable to find main class -> [Help 1]
根据http://www.jianshu.com/p/b521f819b06a里的方法解决了这个问题。
就是在pom文件新增一个配置,其中start-class为你的启动类
<properties> <start-class>com.xxx.Application</start-class> </properties>
<plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <version>1.3.6.RELEASE</version> <configuration> <mainClass>${start-class}</mainClass> </configuration> <executions> <execution> <goals> <goal>repackage</goal> </goals> </execution> </executions> </plugin>
这样就可以正常打包了。
相关文章推荐
- Maven使用package打包Spring Boot时出现:Unable to find a single main class from the following candidates的问题解决
- Springboot repackage failed: Unable to find a single main class from the following candidates
- SpringBoot学习之一 Unable to find a single main class from the following candidates
- Spring Boot应用的Unable to find main class异常详解
- Execution default of goal org.springframework.boot:spring-boot-maven-plugin:1.5.6.RELEASE:repackage failed: Unable to find main class
- Caused by: java.lang.IllegalStateException: Unable to find a single main class from问题解决
- SpringBoot控制台程序不允许出现多个含main方法的类--Unable to find a single main class
- spring boot maven Unable to find main class
- Unable to find a single main class from the following candidates
- Spring-boot Unable to start EmbeddedWebApplicationContext 分析与解决方法
- unable to find javac compiler;com.sun.tools.javac.Mainisnotontheclasspath的问题的解决
- maven项目,多个依赖,打成一个可执行jar包,可根据profiles进行打包,出现的Could not find or load main class的解决方法。
- Unable to find a single main class from the following candidates
- 解决com.sun.tools.javac.Main is not on the classpath / Unable to find a javac compiler 的问题
- Unable to find a single main class from the following candidates
- Unable to find explicit activity class另类的解决方法
- Unable to find config file. Creating new servlet engine config file: /WEB-INF/server-config.wsdd的解决方法
- 执行make menucofig发生错误“Unable to find the ncurses libraries or the required header files”的解决方法
- 错误"Unable to find manifest signing certificate in the certificate store"的解决方法
- Could not find the main class: org.apache.hadoop.hdfs.server.namenode.NameNode.解决方法