1. 使用springboot插件

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.8
version = '1.0'
jar {
manifest {
attributes 'Implementation-Title': 'Gradle Quickstart',
'Implementation-Version': version
}
} repositories {
mavenCentral()
} dependencies {
compile project(':dubbo-hello-api')
compile group: 'com.alibaba', name: 'dubbo', version: '2.5.5'
} test {
systemProperties 'property': 'value'
} uploadArchives {
repositories {
flatDir {
dirs 'repos'
}
}
}

2. 使用application

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'application' sourceCompatibility = 1.8
version = '1.0'
mainClassName = 'm.dubbo.demo.provider.DemoProvider' repositories {
mavenCentral()
} dependencies {
compile project(':dubbo-hello-api')
compile group: 'com.alibaba', name: 'dubbo', version: '2.5.5'
} jar { from configurations.compile.collect { zipTree it}//gradle build生成jar包含了依赖的jar包(被解压缩)
manifest {
attributes 'Manifest-Version': '1.0.0',
'Main-Class': mainClassName,
'Class-Path': configurations.compile.collect { it.getName() }.join(' ') //将依赖的包加到classpath,然后gradle installDist
}
} test {
systemProperties 'property': 'value'
} uploadArchives {
repositories {
flatDir {
dirs 'repos'
}
}
}

Gradle打包jar可执行程序的更多相关文章

  1. gradle 打包 jar (一波三折)

    第一次尝试,打包成功,运行失败 build.gradle 打包 jar { baseName 'testJar' from { //添加依懒到打包文件 //configurations.compile ...

  2. Android Studio 使用 Gradle 打包 Jar

    Android Studio 打 Jar 包一直是一个麻烦的事,按照网上现有的教程,打包一个混淆的 jar 需要完成下列步骤: 1.将 plugin 修改为 library 后 build 出 aar ...

  3. 使用gradle打包jar包

    近期用android studio来做android开发的IDE,它是使用gradle来构建的,于是開始学习gradle. 如今有一个项目,里面有一个android-library的模块.我想在做re ...

  4. android studio 使用gradle 导出jar包,并打包assets目录

    警告:本文年久失修. 随着android studio的升级 ,gradle的升级,严格按照本文的代码去做可能不会成功,希望依然可以作为解决问题的思路. 最近项目在做一个sdk,供别的开发者使用,所以 ...

  5. [转]--android studio 使用gradle 导出jar包,并打包assets目录

    转自: http://www.cnblogs.com/wuya/p/android-studio-gradle-export-jar-assets.html   最近项目在做一个sdk,供别的开发者使 ...

  6. AndroidStduio3.0 使用gradle将module打包jar文件

    AndroidStduio3.0使用gradle将module打包jar文件,首先需要安装gradle. 打开控制台输入      open -e .bash_profile     命令,就可以打开 ...

  7. gradle 打包springboot项目,找不到项目jar application.class

    如题:gradle 打包springboot项目,找不到项目jar入口main方法:application.class 检查:lib/目录下没有相应项目的jar包 用gradle命令行查看日志:gra ...

  8. Spring Boot Gradle 打包可执行Jar文件!

    使用Gradle构建项目,继承了Ant的灵活和Maven的生命周期管理,不再使用XML作为配置文件格式,采用了DSL格式,使得脚本更加简洁. 构建环境: jdk1.6以上,此处使用1.8 Gradle ...

  9. [原]Android打包之Gradle打包

    最近尝试了一下Android的Gradle打包,发现确实比Ant打包会方便很多,特此记录下来. 注:android的gradle现在插件的版本已经是0.14.3了,对于一些老的方法和api,有一些已经 ...

随机推荐

  1. 秒懂C#通过Emit动态生成代码 C#使用Emit构造拦截器动态代理类

    秒懂C#通过Emit动态生成代码   首先需要声明一个程序集名称, 1 // specify a new assembly name 2 var assemblyName = new Assembly ...

  2. JsonArray和JsonObject的使用

    import net.sf.json.JSONArray; import net.sf.json.JSONObject; public class JsonTest { public static v ...

  3. VMWare无法共享文件夹(Win7宿主机\Ubuntu14.04客户机)

    在安装VMWare tools的时候,需要执行 vmware-install.pl.在安装过程中,需要编译vmhgfs module,如果编译失败就很可能导致共享文件夹无法正常挂载. 最近,我在虚拟机 ...

  4. servlet container:tomcat jetty and undertow

    1 spring boot内嵌容器支持tomcat.jetty和undertow 但是undertow性能最好,详见: https://examples.javacodegeeks.com/enter ...

  5. C语言8大经典排序算法(1)

    算法一直是编程的基础,而排序算法是学习算法的开始,排序也是数据处理的重要内容.所谓排序是指将一个无序列整理成按非递减顺序排列的有序序列.排列的方法有很多,根据待排序序列的规模以及对数据的处理的要求,可 ...

  6. luogu 3388 【模板】割点(割顶)

    点双. #include<iostream> #include<cstdio> #include<cstdlib> #include<cstring> ...

  7. 7. ExtJS.form中msgTarget

    转自:https://www.cnblogs.com/guafuli/articles/msgtarget_values.html Ext表单提示方式:msgTarget:有4中方式:qtip,tit ...

  8. 【培训】MySQL

    yum安装mysql:yum -y install mysql*- 或者 yum -y install mysql* 启动数据库服务:/etc/init.d/mysqld start 或者 servi ...

  9. Helios Service Release 2安装SVN

    Eclipse Helios Service Release 2安装SVN地址:subclipse http://subclipse.tigris.org/update_1.6.x 1.使用方式:he ...

  10. Linux day01(一) 创建Linux虚拟机,设置虚拟机默认属性,虚拟机和Xhell建立连接

    一:创建Linux虚拟机步骤: 1. 二:设置虚拟机默认属性 三:虚拟机和Xhell建立连接