gradle配置说明

1 概述
轻轨线(CI/CD)构建java代码时,采用gradle构建的方式,默认情况下会在苍穹应用java工程目录下(示例:/demo/fi/app01/java/project01)内置一份build.gradle文件,流水线构建的时候使用默认的build.gradle文件,用户无需手动添加。当默认的build.gradle文件不能满足要求时,需要自己在代码目录中维护一份build.gradle.server文件,添加后缀.server文件是为了区分本地build.gradle文件。

苍穹应用对应路径:

2 gradle默认配置
默认内置的build.gradle内容如下:
apply plugin: 'java'
apply plugin: 'eclipse'
group = 'de.cd'
version = '1.0'
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
def cus= 'DEPENDON_JARS_PATH/cus'
def trd= 'DEPENDON_JARS_PATH/trd'
def bos= 'DEPENDON_JARS_PATH/bos'
def biz= 'DEPENDON_JARS_PATH/biz'
def outputdir='OUTPUTDIR'
String date = new Date().format('yyyy-MM-dd HH:mm:ss SSSSSS')
jar{
manifest {
attributes 'Builddate': date
attributes 'Release': 'CICD'
}
}
dependencies {
compile fileTree(dir: cus, include: '*.jar')
compile fileTree(dir: trd, include: '*.jar')
compile fileTree(dir: bos, include: '*.jar')
compile fileTree(dir: biz, include: '*.jar')
}
task sourcesJar(type: Jar, dependsOn: build) {
classifier = 'sources'
from sourceSets.main.allSource
}
task copytolib(type: Copy,dependsOn: build){
group 'build'
description 'copy to lib'
from 'build/libs'
into outputdir
exclude '*source*.jar'
}
task copyJarTodir(type: Copy){
group 'build'
description 'copyJarTodir'
from 'build/libs'
into cus
exclude '**/*.class'
}
test.ignoreFailures true其中参数DEPENDON_JARS_PATH在运行时会被替换为拉取的平台jar包的实际路径,参数OUTPUTDIR 在运行时会被替换为jar包的实际输出路径,这两个参数不可更改。
3 自定
gradle配置说明
1 概述轻轨线(CI/CD)构建java代码时,采用gradle构建的方式,默认情况下会在苍穹应用java工程目录下(示例:/demo/fi/app01/java/projec...
点击下载文档文档为doc格式
声明:除非特别标注,否则均为本站原创文章,转载时请以链接形式注明文章出处。如若本站内容侵犯了原著者的合法权益,可联系本站删除。
上一篇
已经是第一篇



