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包名}
跑起来,成功