zyhy_cosmic6/build.gradle

152 lines
4.0 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-07-03 10:20:57
*/
plugins {
id 'java'
//https://docs.gradle.org/current/userguide/java_library_plugin.html#java_library_plugin
id 'java-library'
//id 'maven-publish'
//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 'cn.hutool:hutool-all:5.8.20'
//implementation 'ch.qos.logback:logback-classic:1.2.12'
//implementation 'org.slf4j:log4j-over-slf4j:1.7.36'
//implementation 'org.apache.logging.log4j:log4j-to-slf4j: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 {
}
//生成本工程jar包并拷贝到outputdir目录
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'
}
}
}
//生成本工程jar包并拷贝到拷贝到cus目录
task deployJar(type: Copy, dependsOn: build){
group 'build'
description '生成本工程jar包并拷贝到拷贝到cus目录'
from 'build/libs'
into cus
exclude '*sources.jar','*javadoc.jar','*cosmic-debug*.jar'
processResources{
from('src/main/java'){
include '**/*.properties'
}
}
}
test.ignoreFailures true
}