mirror of
https://gitee.com/dromara/MaxKey.git
synced 2025-12-06 17:08:29 +08:00
build.gradle
This commit is contained in:
parent
a22c9f1235
commit
9770d0cb23
255
build.gradle
255
build.gradle
@ -22,11 +22,42 @@ defaultTasks "clean", "build"
|
||||
|
||||
//Version define
|
||||
ext {
|
||||
|
||||
|
||||
}
|
||||
|
||||
def libjarsmapper=[
|
||||
'maxkey-authentication-otp' :'lib',
|
||||
'maxkey-authentication-captcha' :'lib',
|
||||
'maxkey-authentication-core' :'lib',
|
||||
'maxkey-common' :'lib',
|
||||
'maxkey-core' :'lib',
|
||||
'maxkey-persistence' :'lib',
|
||||
'maxkey-protocol-authorize' :'lib',
|
||||
'maxkey-protocol-cas' :'lib',
|
||||
'maxkey-protocol-desktop' :'lib',
|
||||
'maxkey-protocol-extendapi' :'lib',
|
||||
'maxkey-protocol-formbased' :'lib',
|
||||
'maxkey-protocol-jwt' :'lib',
|
||||
'maxkey-protocol-oauth-2.0' :'lib',
|
||||
'maxkey-protocol-saml-2.0' :'lib',
|
||||
'maxkey-protocol-tokenbased' :'lib',
|
||||
'maxkey-web-resources' :'lib',
|
||||
'maxkey-authentication-social' :'maxkey',
|
||||
'maxkey-web-maxkey' :'maxkey',
|
||||
'maxkey-identity-rest' :'maxkey_mgt',
|
||||
'maxkey-identity-scim' :'maxkey_mgt',
|
||||
'maxkey-web-mgt' :'maxkey_mgt',
|
||||
'maxkey-synchronizers' :'maxkey_mgt',
|
||||
'maxkey-synchronizers-activedirectory' :'maxkey_mgt',
|
||||
'maxkey-synchronizers-ldap' :'maxkey_mgt',
|
||||
'maxkey-synchronizers-dingding' :'maxkey_mgt',
|
||||
'maxkey-synchronizers-workweixin' :'maxkey_mgt',
|
||||
'maxkey-synchronizers-reorgdept' :'maxkey_mgt',
|
||||
'maxkey-boot-monitor' :'maxkey_monitor'
|
||||
]
|
||||
|
||||
configurations.all {
|
||||
transitive = false// 为本依赖关闭依赖传递特性
|
||||
transitive = false// 为本依赖关闭依赖传递特性
|
||||
}
|
||||
|
||||
//add support for Java
|
||||
@ -38,24 +69,23 @@ allprojects {
|
||||
//apply plugin: "findbugs"
|
||||
//apply plugin: "jdepend"
|
||||
|
||||
configurations.all {
|
||||
transitive = false// 为本依赖关闭依赖传递特性
|
||||
}
|
||||
//java Version
|
||||
sourceCompatibility = 1.8
|
||||
targetCompatibility = 1.8
|
||||
compileJava.options.encoding = 'UTF-8'
|
||||
|
||||
/*
|
||||
eclipse {
|
||||
第一次时请注释这段eclipse设置,可能报错,设置工程字符集
|
||||
jdt {
|
||||
File f = file('.settings/org.eclipse.core.resources.prefs')
|
||||
f.write('eclipse.preferences.version=1\n')
|
||||
f.append('encoding/<project>=UTF-8') //use UTF-8
|
||||
}
|
||||
}
|
||||
*/
|
||||
configurations.all {
|
||||
transitive = false// 为本依赖关闭依赖传递特性
|
||||
}
|
||||
//java Version
|
||||
sourceCompatibility = 1.8
|
||||
targetCompatibility = 1.8
|
||||
compileJava.options.encoding = 'UTF-8'
|
||||
|
||||
eclipse {
|
||||
/* 第一次时请注释这段eclipse设置,可能报错,设置工程字符集
|
||||
jdt {
|
||||
File f = file('.settings/org.eclipse.core.resources.prefs')
|
||||
f.write('eclipse.preferences.version=1\n')
|
||||
f.append('encoding/<project>=UTF-8') //use UTF-8
|
||||
}*/
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -74,34 +104,39 @@ repositories {
|
||||
|
||||
}
|
||||
|
||||
// In this section you declare the dependencies for your production and test code
|
||||
dependencies {
|
||||
|
||||
}
|
||||
|
||||
|
||||
subprojects {
|
||||
/*
|
||||
eclipse {
|
||||
第一次时请注释这段eclipse设置,可能报错,设置工程字符集
|
||||
jdt {
|
||||
File f = file('.settings/org.eclipse.core.resources.prefs')
|
||||
f.write('eclipse.preferences.version=1\n')
|
||||
f.append('encoding/<project>=UTF-8') //use UTF-8
|
||||
}
|
||||
}
|
||||
*/
|
||||
processResources {
|
||||
from ('src/main/resources') {
|
||||
include 'src/main/resources/*.*'
|
||||
}
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
java {
|
||||
srcDir 'src/main/java' // 指定源码目录
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
subprojects {
|
||||
/*
|
||||
eclipse {
|
||||
第一次时请注释这段eclipse设置,可能报错,设置工程字符集
|
||||
jdt {
|
||||
File f = file('.settings/org.eclipse.core.resources.prefs')
|
||||
f.write('eclipse.preferences.version=1\n')
|
||||
f.append('encoding/<project>=UTF-8') //use UTF-8
|
||||
}
|
||||
}
|
||||
*/
|
||||
processResources {
|
||||
from ('src/main/resources') {
|
||||
include 'src/main/resources/*.*'
|
||||
}
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
java {
|
||||
srcDir 'src/main/java' // 指定源码目录
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
maven { url "https://maven.aliyun.com/repository/central/"}
|
||||
maven { url "https://maven.aliyun.com/repository/public/"}
|
||||
@ -119,10 +154,11 @@ subprojects {
|
||||
maven { url "https://repository.apache.org/content/repositories/releases/" }
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
//all dependencies
|
||||
dependencies {
|
||||
//for Test and Compile
|
||||
|
||||
//all dependencies
|
||||
dependencies {
|
||||
|
||||
//for Test and Compile
|
||||
testImplementation group: 'junit', name: 'junit', version: "${junitVersion}"
|
||||
compileOnly group: 'junit', name: 'junit', version: "${junitVersion}"
|
||||
testImplementation group: 'org.mockito', name: 'mockito-all', version: "${mockitoallVersion}"
|
||||
@ -407,37 +443,102 @@ subprojects {
|
||||
|
||||
jar {
|
||||
|
||||
def currentTime = java.time.ZonedDateTime.now()
|
||||
manifest {
|
||||
attributes(
|
||||
"Implementation-Title": project.name,
|
||||
"Implementation-Vendor": project.vendor,
|
||||
"Created-By": project.author,
|
||||
"Implementation-Date": currentTime,
|
||||
"Implementation-Version": project.version
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
task buildRelease() {
|
||||
dependsOn assemble
|
||||
//项目名
|
||||
println "subproject " + project.name + ", group " + project.group +" , version " + project.version
|
||||
}
|
||||
def currentTime = java.time.ZonedDateTime.now()
|
||||
manifest {
|
||||
attributes(
|
||||
"Implementation-Title": project.name,
|
||||
"Implementation-Vendor": project.vendor,
|
||||
"Created-By": project.author,
|
||||
"Implementation-Date": currentTime,
|
||||
"Implementation-Version": project.version
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
tasks.register("buildRelease",Copy) {
|
||||
dependsOn assemble
|
||||
//项目名 项目所在的group version 版本号
|
||||
println "subproject " + project.name + ", group " + project.group +" , version " + project.version
|
||||
|
||||
//copy
|
||||
into "$rootDir/build/maxkey-jars/"
|
||||
from "$buildDir/libs/"
|
||||
include '*.jar'
|
||||
}
|
||||
|
||||
tasks.register("copyLibJars",Copy) {
|
||||
if (libjarsmapper["${project.name}"] != null){
|
||||
into "$rootDir/build/MaxKey-v${project.version}GA/"+libjarsmapper["${project.name}"]
|
||||
from "$buildDir/libs/"
|
||||
include '*.jar'
|
||||
}
|
||||
}
|
||||
assemble.configure { finalizedBy buildRelease,copyLibJars }
|
||||
}
|
||||
|
||||
assemble.configure { finalizedBy buildRelease }
|
||||
//copy Dep Jars to /build/maxkey-depjars,only maxkey-common deps
|
||||
project('maxkey-common') {
|
||||
task createReleaseDir(type: Copy){
|
||||
def paths = ["$rootDir/build/MaxKey-v${project.version}GA",
|
||||
"$rootDir/build/MaxKey-v${project.version}GA/maxkey",
|
||||
"$rootDir/build/MaxKey-v${project.version}GA/maxkey_mgt",
|
||||
"$rootDir/build/MaxKey-v${project.version}GA/maxkey_monitor",
|
||||
"$rootDir/build/MaxKey-v${project.version}GA/lib"];
|
||||
//遍历数组,调用createDir闭包,创建目录
|
||||
paths.forEach(){path->
|
||||
File dir=new File(path);
|
||||
if (!dir.exists()){
|
||||
print("create "+path+"\n")
|
||||
dir.mkdirs();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
task copyDepJars (type: Copy){
|
||||
dependsOn assemble
|
||||
println "copy Dep Jars to $rootDir/build/MaxKey-v${project.version}GA/lib"
|
||||
//copy runtime
|
||||
from configurations.runtimeClasspath
|
||||
into "$rootDir/build/MaxKey-v${project.version}GA/lib";
|
||||
}
|
||||
|
||||
build.configure { finalizedBy copyDepJars }
|
||||
}
|
||||
|
||||
//copy Dep Jars to /build/maxkey-depjars,only maxkey-boot-monitor deps
|
||||
project('maxkey-webs:maxkey-boot-monitor') {
|
||||
task copyDepJars(type:Copy) {
|
||||
dependsOn assemble
|
||||
//项目名 项目所在的group version 版本号
|
||||
println "subproject " + project.name + ", group " + project.group +" , version " + project.version
|
||||
//copy runtime
|
||||
from configurations.runtimeClasspath
|
||||
into "$rootDir/build/MaxKey-v${project.version}GA/maxkey_monitor";
|
||||
}
|
||||
|
||||
build.configure { finalizedBy copyDepJars }
|
||||
}
|
||||
|
||||
tasks.register("buildRelease") {
|
||||
//项目名 项目所在的group version 版本号
|
||||
println "Root project " + project.name + ", group " + project.group +" , version " + project.version
|
||||
//项目的绝对路径 to 项目的build文件绝对路径
|
||||
println "Root project projectDir " + project.projectDir +" to " + project.buildDir
|
||||
dependsOn 'copyShellScript','copyWindowsShellScript'
|
||||
|
||||
//项目名 项目所在的group version 版本号
|
||||
println "Root project " + project.name + ", group " + project.group +" , version " + project.version
|
||||
//项目的绝对路径 to 项目的build文件绝对路径
|
||||
println "Root project projectDir " + project.projectDir +" to " + project.buildDir
|
||||
}
|
||||
|
||||
tasks.register("copyShellScript",Copy) {
|
||||
println "project copyMaxKeyShellScript .";
|
||||
|
||||
from "$rootDir/shellscript/"
|
||||
into "$rootDir/build/MaxKey-v${project.version}GA/shellscript/";
|
||||
}
|
||||
|
||||
tasks.register("copyWindowsShellScript",Copy) {
|
||||
println "project copyMaxKeyWindowsShellScript .";
|
||||
from "$rootDir/shellscript/windows"
|
||||
into "$rootDir/build/MaxKey-v${project.version}GA/";
|
||||
}
|
||||
|
||||
build.configure { finalizedBy buildRelease }
|
||||
|
||||
// In this section you declare the dependencies for your production and test code
|
||||
dependencies {
|
||||
|
||||
}
|
||||
|
||||
@ -1,42 +1,7 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
maven { url 'https://maven.aliyun.com/nexus/content/groups/public/'}
|
||||
}
|
||||
}
|
||||
|
||||
plugins {
|
||||
id 'java'
|
||||
id 'com.google.cloud.tools.jib' version "${jibGradlePluginVersion}"
|
||||
id 'org.springframework.boot' version "${springBootVersion}"
|
||||
}
|
||||
|
||||
apply plugin: 'com.google.cloud.tools.jib'
|
||||
|
||||
description = "maxkey-web-maxkey"
|
||||
|
||||
//docker
|
||||
jib {
|
||||
from {
|
||||
image = "${jibFromImage}"
|
||||
}
|
||||
to {
|
||||
//https://registry.hub.docker.com/repository/docker/maxkeytop/maxkey
|
||||
image = "${jibToImage}/maxkey"
|
||||
tags = ["${project.version}".toString(), 'latest']
|
||||
auth {
|
||||
username = "${jibToAuthUsername}"
|
||||
password = "${jibToAuthPassword}"
|
||||
}
|
||||
}
|
||||
container {
|
||||
mainClass = "org.maxkey.MaxKeyApplication"
|
||||
jvmFlags = ['-Dfile.encoding=utf-8', '-Dserver.port=443','-Duser.timezone=Asia/Shanghai']
|
||||
ports = ['443']
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//build.configure { finalizedBy jib }
|
||||
//add support for Java
|
||||
apply plugin: 'java'
|
||||
|
||||
dependencies {
|
||||
implementation project(":maxkey-common")
|
||||
@ -58,5 +23,4 @@ dependencies {
|
||||
implementation project(":maxkey-protocols:maxkey-protocol-jwt")
|
||||
|
||||
implementation project(":maxkey-webs:maxkey-web-resources")
|
||||
|
||||
}
|
||||
|
||||
@ -1,42 +1,7 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
maven { url 'https://maven.aliyun.com/nexus/content/groups/public/'}
|
||||
}
|
||||
}
|
||||
//docker
|
||||
plugins {
|
||||
id 'java'
|
||||
id 'com.google.cloud.tools.jib' version "${jibGradlePluginVersion}"
|
||||
id 'org.springframework.boot' version "${springBootVersion}"
|
||||
}
|
||||
|
||||
|
||||
apply plugin: 'com.google.cloud.tools.jib'
|
||||
|
||||
description = "maxkey-web-mgt"
|
||||
|
||||
jib {
|
||||
from {
|
||||
image = "${jibFromImage}"
|
||||
}
|
||||
to {
|
||||
//https://registry.hub.docker.com/repository/docker/maxkeytop/maxkey-mgt
|
||||
image = "${jibToImage}/maxkey-mgt"
|
||||
tags = ["${project.version}".toString(), 'latest']
|
||||
auth {
|
||||
username = "${jibToAuthUsername}"
|
||||
password = "${jibToAuthPassword}"
|
||||
}
|
||||
|
||||
}
|
||||
container {
|
||||
mainClass = "org.maxkey.MaxKeyMgtApplication"
|
||||
jvmFlags = ['-Dfile.encoding=utf-8', '-Dserver.port=9527','-Duser.timezone=Asia/Shanghai']
|
||||
ports = ['9527']
|
||||
}
|
||||
}
|
||||
|
||||
//build.configure { finalizedBy jib }
|
||||
//add support for Java
|
||||
apply plugin: 'java'
|
||||
|
||||
dependencies {
|
||||
implementation project(":maxkey-common")
|
||||
@ -60,5 +25,4 @@ dependencies {
|
||||
implementation project(":maxkey-identitys:maxkey-synchronizers-dingding")
|
||||
|
||||
implementation project(":maxkey-webs:maxkey-web-resources")
|
||||
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user