BUG记录:Gradle打包-没有主清单属性

Gradle-没有主清单属性(Gradle- no main manifest attribute)

解决方法:修改文件build.gradle,完成样式

buildscript {
    ext{
        springBootVersion = '2.0.2.RELEASE'
        springCloudVersion = 'Finchley.RELEASE'
    }

    repositories {
        maven{ url 'http://maven.aliyun.com/nexus/content/groups/public/'}
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
    }
}


group 'com.bf'
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'org.springframework.boot'

version = '1.0.0'
sourceCompatibility = 1.8
targetCompatibility = 1.8

repositories {
    mavenLocal()
    maven{ url 'http://maven.aliyun.com/nexus/content/groups/public/'}
}

dependencyManagement {
    imports {
        mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
    }
}

test {
    ignoreFailures = true
}

dependencies {
    compile 'org.springframework.boot:spring-boot-starter-web'
    compile 'org.mybatis.spring.boot:mybatis-spring-boot-starter:2.0.0'
    compile 'org.springframework.security.oauth.boot:spring-security-oauth2-autoconfigure:2.0.0.RELEASE'

    compile 'org.apache.httpcomponents:httpclient:4.5.5'
    compile 'tk.mybatis:mapper-spring-boot-starter:2.0.0'
    
    compile 'io.springfox:springfox-swagger2:2.7.0'
    compile 'io.springfox:springfox-swagger-ui:2.7.0'

    compile 'net.sf.json-lib:json-lib:2.4:jdk15'
    compile 'com.alibaba:fastjson:1.2.62'

    testCompile 'org.springframework.boot:spring-boot-starter-test'
}

执行:gradle build -x test 命令
在这里插入图片描述

查看jar文件,出现红色框里内容表示成功
在这里插入图片描述

在本地jar包下打开cmd测试 ,执行命令java -jar #{jar包名}

在这里插入图片描述

跑起来,成功
在这里插入图片描述

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值