spring boot打包时Unable to find a single main class的解决方法

最近团队开始开发一个新产品,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为你的启动类

<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>
这样就可以正常打包了。

  • 4
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值