gradle 学习记录

gradle

Author : Janloong Do_O

jar配置

jar {
    //清单文件配置
     manifest {
          attributes 'Manifest-Version': '1.0'
          attributes 'Implementation-Title': '这是程序主程序'
  //        attributes 'JavaFX-Preloader-Class': 'com.janloong.fxpreloader.MainPreloader'
          attributes 'Implementation-Version': ''
          attributes 'Permissions': 'sandbox'
          attributes 'JavaFX-Version': '8.0'
          attributes 'Class-Path': 'lib/core-8.0.1.jar '+'lib/datafx-8.0.1.jar '+'lib/flow-8.0.1.jar ' +
                  ''+'lib/fontawesomefx-commons-8.15.jar '+'lib/fontawesomefx-commons-8.15.jar '
  //        attributes 'Class-Path': 'FXpreloader.jar'
          attributes 'Created-By': 'JavaFX Packager'
          attributes 'Implementation-Vendor': ''
          attributes 'Main-Class': 'com.janloong.fxworld.MainApp'
      }
    <!--  把所有运行时的jar都打入jar中-->
    into('lib') {
        from configurations.runtime
    }
}

项目目录结构

sourceSets {

   //设置源代码所在目录
   main {
       java {
           srcDirs = ['src']
       }
   }

   //设置测试代码所在目录
   test {
       java {
           srcDirs = ['test']
       }
   }

}


buildDir = ‘out’

增量构建机制

task combineFileContentIncremental {
   def sources = fileTree('sourceDir')
   def destination = file('destination.txt')

   inputs.dir sources
   outputs.file destination

   doLast {
      destination.withPrintWriter { writer ->
         sources.each {source ->
            writer.println source.text
         }
      }
   }
}

默认property

Gradle在默认情况下已经为Project定义了很多Property,其中比较常用的有:

project:Project本身
name:Project的名字
path:Project的绝对路径
description:Project的描述信息 (project.description)  若在task里面则是task本身的描述信息
buildDir:Project构建结果存放目录
version:Project的版本号

jar

dependencies {
   compile files('spring-core.jar', 'spring-aap.jar')
   compile fileTree(dir: 'deps', include: '*.jar')
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值