1. Using the Springboot plugin
Apply plugin: ' java ' Apply plugin: ' Eclipse ' Apply plugin: 'spring-boot' buildscript { ext { springbootversion = ' 1.2.5.RELEASE ' } repositories { jcenter () mavenlocal () mavencentral () } dependencies { classpath "org.springframework.boot:spring-boot-gradle-plugin:${springbootversion}"} } sourcecompatibility = 1.8version = ' 1.0 ' jar { manifest { attributes ' implementation-title ': ' Gradle Quickstart ', ' implementation-version ': Version }}repositories { mavencentral ()}dependencies { Compile project (':d Ubbo-hello-api ') compile group: ' Com.alibaba ', Name: ' Dubbo ', Version: ' 2.5.5 '}test { systemproperties ' property ': ' Value '}uploadarchives { repositories { Flatdir { dirs ' repos ' } }}
2. Using Application
Apply plugin: ' java ' Apply plugin: ' Eclipse ' Apply plugin: 'application' sourcecompatibility = 1.8version = ' 1.0 ' Mainclassname = ' M.dubbo.demo.provider.demoprovider ' repositories { mavencentral ()}dependencies { Compile Project (':d Ubbo-hello-api ') compile group: ' Com.alibaba ', Name: ' Dubbo ', Version: ' 2.5.5 '}jar { from Configurations.compile.collect {ziptree It}//gradle build jar contains dependent jar package (uncompressed) manifest { attributes ' Manifest-version ': ' 1.0.0 ', ' main-class ': mainclassname, ' Class-path ': configurations.compile.collect { it.getname () }. Join (')//Add dependent package to Classpath, then Gradle installdist }}test { systemproperties ' property ': ' Value '} uploadarchives { repositories { Flatdir { dirs ' repos '}} }
Gradle Package Jar Executable program