171 lines
4.5 KiB
Groovy
171 lines
4.5 KiB
Groovy
|
/**
|
||
|
* This is a kingdee cosmic template project that is automatically generated by the Kingdee cosmic development assistant plugin.
|
||
|
* If there are any issues during the use process, you can provide feedback to the kingdee developer community website.
|
||
|
* Website: https://developer.kingdee.com/developer?productLineId=29
|
||
|
* Author: liebin.zheng
|
||
|
* Generate Date: 2024-05-06 10:17:02
|
||
|
*/
|
||
|
|
||
|
plugins {
|
||
|
id 'java'
|
||
|
id 'java-library'
|
||
|
//https://docs.gradle.org/current/userguide/idea_plugin.html
|
||
|
id 'idea'
|
||
|
//https://docs.gradle.org/current/userguide/eclipse_plugin.html
|
||
|
id 'eclipse'
|
||
|
//id "org.sonarqube" version "3.5.0.2730"
|
||
|
}
|
||
|
|
||
|
apply from: 'config.gradle'
|
||
|
|
||
|
def bos = ext.path.bos
|
||
|
def trd = ext.path.trd
|
||
|
def cus = ext.path.cus
|
||
|
def biz = ext.path.biz
|
||
|
def outputdir = ext.path.outputdir
|
||
|
|
||
|
//所有工程共用的配置
|
||
|
allprojects {
|
||
|
|
||
|
apply plugin: 'java'
|
||
|
apply plugin: 'maven-publish'
|
||
|
apply plugin: 'java-library'
|
||
|
apply plugin: 'eclipse'
|
||
|
apply plugin: 'idea'
|
||
|
|
||
|
repositories{
|
||
|
mavenLocal()
|
||
|
maven{ url'https://maven.aliyun.com/repository/public/'}
|
||
|
maven{ url'https://maven.aliyun.com/repository/gradle-plugin'}
|
||
|
mavenCentral()
|
||
|
//maven { url 'https://repo.gradle.org/gradle/libs-releases' }
|
||
|
//gradlePluginPortal()
|
||
|
}
|
||
|
|
||
|
group = System.getProperty('groupId')
|
||
|
version = System.getProperty('version')
|
||
|
|
||
|
def jdk_version = System.getProperty('jdk.version')
|
||
|
sourceCompatibility = jdk_version
|
||
|
targetCompatibility = jdk_version
|
||
|
|
||
|
tasks.withType(JavaCompile) {
|
||
|
options.encoding = "UTF-8"
|
||
|
}
|
||
|
|
||
|
dependencies {
|
||
|
implementation fileTree(dir: bos, include: '*.jar')
|
||
|
//testImplementation "org.gradle:gradle-tooling-api:7.3-20210825160000+0000"
|
||
|
//testImplementation gradleTestKit()
|
||
|
implementation 'cn.hutool:hutool-all:5.8.20'
|
||
|
implementation 'org.apache.logging.log4j:log4j-core:2.20.0'
|
||
|
testImplementation platform('org.junit:junit-bom:5.9.1')
|
||
|
testImplementation 'org.junit.jupiter:junit-jupiter'
|
||
|
}
|
||
|
|
||
|
test {
|
||
|
useJUnitPlatform()
|
||
|
}
|
||
|
|
||
|
java {
|
||
|
withSourcesJar()
|
||
|
//withJavadocJar()
|
||
|
}
|
||
|
|
||
|
Date now = new Date()
|
||
|
String date = now.format('yyyy-MM-dd HH:mm:ss')
|
||
|
String buildNum = now.format('yyyyMMddHHmmssSSS')
|
||
|
|
||
|
String gitCommitShortHash = ''
|
||
|
String gitBranch = ''
|
||
|
try{
|
||
|
gitCommitShortHash = 'git log -1 --pretty=%H'.execute([], project.rootDir).text.trim()
|
||
|
gitBranch = 'git branch --show-current'.execute([], project.rootDir).text.trim()
|
||
|
} catch(Exception e){
|
||
|
println "warning: the commandline tools of git was not installed!"
|
||
|
}
|
||
|
|
||
|
jar {
|
||
|
manifest {
|
||
|
attributes 'Group-Name': project.group
|
||
|
attributes 'Project-Name': project.name
|
||
|
attributes 'Bundle-Version': project.version
|
||
|
attributes 'Build-Num': buildNum
|
||
|
attributes 'Build-Date': date
|
||
|
attributes 'Build-Jdk': System.getProperty('java.version')
|
||
|
attributes 'Built-By': 'Kingdee Cosmic Developer Tools'
|
||
|
attributes 'Build-Tool': 'Gradle ' + project.gradle.gradleVersion
|
||
|
attributes 'Git-Commit-Hash': gitCommitShortHash
|
||
|
attributes 'Git-Branch': gitBranch
|
||
|
attributes 'Cloud-Name': ''
|
||
|
attributes 'App-Name': ''
|
||
|
attributes 'Jar-Id': ''
|
||
|
attributes 'Build-Image': ''
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
}
|
||
|
|
||
|
//所有子工程共用的配置
|
||
|
subprojects {
|
||
|
|
||
|
dependencies {
|
||
|
implementation fileTree(dir: biz, include: '*.jar')
|
||
|
implementation fileTree(dir: cus, include: '*.jar')
|
||
|
implementation fileTree(dir: trd, include: '*.jar', exclude: 'log4j-api-*.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(cicd专用-旧的gradle任务)'
|
||
|
from 'build/libs'
|
||
|
into outputdir
|
||
|
exclude '*sources.jar','*javadoc.jar','*cosmic-debug*.jar'
|
||
|
processResources{
|
||
|
from('src/main/java'){
|
||
|
include '**/*.properties'
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
task copyJarToDir(type: Copy){
|
||
|
group 'build'
|
||
|
description 'copy Jar To Dir(cicd专用-旧的gradle任务)'
|
||
|
from 'build/libs'
|
||
|
into cus
|
||
|
exclude '**/*.class'
|
||
|
}
|
||
|
|
||
|
task buildJar(type: Copy, dependsOn: build){
|
||
|
group 'build'
|
||
|
description '构建本工程jar包并拷贝到outputdir目录'
|
||
|
from 'build/libs'
|
||
|
into outputdir
|
||
|
exclude '*sources.jar','*javadoc.jar','*cosmic-debug*.jar'
|
||
|
processResources{
|
||
|
from('src/main/java'){
|
||
|
include '**/*.properties'
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
task deployJar(type: Copy, dependsOn: buildJar){
|
||
|
group 'build'
|
||
|
description '将outputdir目录下的jar包拷贝到cus目录'
|
||
|
from outputdir
|
||
|
into cus
|
||
|
exclude '*sources.jar','*javadoc.jar','*cosmic-debug*.jar'
|
||
|
}
|
||
|
|
||
|
test.ignoreFailures true
|
||
|
|
||
|
|
||
|
}
|
||
|
|