代码拉取完成,页面将自动刷新
buildscript {
ext {
springBootVersion = '1.4.2.RELEASE'
}
repositories {
jcenter()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
classpath(group: 'org.jfrog.buildinfo', name: 'build-info-extractor-gradle', version: '4.4.0')
}
}
repositories {
jcenter()
maven { url "http://artifactory-dev.qmatic.net/artifactory/api-gateway" }
}
apply plugin: 'application'
apply plugin: 'com.jfrog.artifactory'
apply plugin: 'distribution'
apply plugin: 'idea'
apply plugin: 'java'
apply plugin: 'maven-publish'
apply plugin: 'org.springframework.boot'
applicationName = 'api-gateway'
version = "${currentVersion}"
def passwordProperty = project.hasProperty('password') ? password : "dummy"
mainClassName = "com.qmatic.apigw.Application"
configurations {
compile.exclude module: "spring-boot-starter-tomcat"
}
dependencies {
compile ("org.springframework.boot:spring-boot-starter-web")
compile ("org.springframework.boot:spring-boot-starter-undertow")
compile ("org.springframework.boot:spring-boot-starter-cache")
compile ("org.springframework.boot:spring-boot-configuration-processor")
compile ("org.springframework.cloud:spring-cloud-starter-zuul:1.2.3.RELEASE")
//Cache metrics : spring-boot-starter-web, spring-boot-starter-actuator
compile ("org.projectlombok:lombok:1.16.12")
//TODO use library.ehcache
compile ("net.sf.ehcache:ehcache-core:2.6.11")
compile files('libs/qp-common-logging-3.1.0.jar')
testCompile ("org.testng:testng:6.10")
testCompile ("org.springframework.boot:spring-boot-starter-test")
}
test {
// enable TestNG support (default is JUnit)
useTestNG()
}
compileJava.dependsOn(processResources)
task wrapper(type: Wrapper) {
gradleVersion = '2.10'
}
jar {
manifest {
attributes 'Build-Version': version
}
baseName = "${qpApiGateway}"
}
task qpCommonGeoJar(type: Jar) {
from sourceSets.main.output.classesDir
exclude '**/apigw/**'
exclude '**/*.json'
manifest {
attributes 'Build-Version': version
}
baseName = "${qpCommonGeo}"
bootRepackage.enabled = false
}
artifacts {
archives qpCommonGeoJar
archives file(buildDir.path + "/distributions/" + "${qpApiGateway}" + "-" + version + ".zip")
}
/* configuration for debugging the gateway */
//applicationDefaultJvmArgs = [ "-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005" ]
/* configuration for publishing artifacts to Qmatic artifactory */
artifactory {
contextUrl = "http://artifactory.qmatic.com/artifactory"
publish {
repository {
repoKey = "api-gateway"
username = "${artifactory_username}"
password = passwordProperty
maven = true
}
defaults {
publications('windist','linuxdist','geojar')
}
}
}
publishing {
publications {
windist(MavenPublication) {
artifact buildDir.path + "/distributions/QP_APIGateway_win64-"+version+".zip"
groupId "com.qmatic"
artifactId "QP_APIGateway_win64"
version project.version
}
linuxdist(MavenPublication) {
artifact buildDir.path + "/distributions/QP_APIGateway_linux64-"+version+".zip"
groupId "com.qmatic"
artifactId "QP_APIGateway_linux64"
version project.version
}
geojar(MavenPublication) {
artifact qpCommonGeoJar
groupId "com.qmatic"
artifactId "${qpCommonGeo}"
version project.version
}
}
}
/* configuration for generating start script and generating token / password */
task apiTokenGeneratorStartScripts(type: CreateStartScripts) {
description "Create start scripts for ApiTokenGenerator"
classpath = startScripts.classpath
outputDir = startScripts.outputDir
mainClassName = 'com.qmatic.apigw.ApiTokenGenerator'
applicationName = 'api-token-generator'
// workaround for https://issues.gradle.org/browse/GRADLE-3084
doLast {
doLastWithScripts(windowsScript, unixScript)
}
}
task passwordEncoderStartScripts(type: CreateStartScripts) {
description "Create start scripts for PasswordEncoder"
classpath = startScripts.classpath
outputDir = startScripts.outputDir
mainClassName = 'com.qmatic.apigw.PasswordEncoder'
applicationName = 'password-encoder'
// workaround for https://issues.gradle.org/browse/GRADLE-3084
doLast {
doLastWithScripts(windowsScript, unixScript)
}
}
distributions {
main {
contents {
into('bin') {
from apiTokenGeneratorStartScripts
fileMode = 0755
from passwordEncoderStartScripts
fileMode = 0755
from('src/main/resources/scripts')
from('src/main/resources/bin')
}
into('conf') {
from('src/main/resources') {
exclude 'scripts'
exclude 'logs'
exclude 'bin'
include '**/application.yml'
include '**/ehcache.xml'
include '**/logbackAPIGateway.xml'
}
}
// We need an empty logs folder as it needs to exist for logging
into('logs') {
from('src/main/resources/logs')
}
}
}
}
startScripts {
defaultJvmOpts = ['DEFAULT_JVM_OPTS_REPLACE']
doLast {
doLastWithScripts(windowsScript, unixScript)
def defaultJvmOptsLinux = '-Dlogging.config=$APP_HOME/conf/logbackAPIGateway.xml\" \"-Dapp.home=$APP_HOME'
def defaultJvmOptsWindows = '-Dlogging.config=%~dp0\\..\\conf\\logbackAPIGateway.xml\" \"-Dapp.home=%~dp0\\..'
unixScript.text = unixScript.text.replace('DEFAULT_JVM_OPTS_REPLACE', defaultJvmOptsLinux)
windowsScript.text = windowsScript.text.replace('DEFAULT_JVM_OPTS_REPLACE', defaultJvmOptsWindows)
}
}
// workaround for https://issues.gradle.org/browse/GRADLE-3084
def doLastWithScripts(windowsScript, unixScript) {
// Fixes Windows classpath issue when classpath becomes too long
def configureWindowsClassPath = { line ->
line.replaceAll(~/^set CLASSPATH.*$/) { newLine ->
'set CLASSPATH=%APP_HOME%\\conf;%APP_HOME%\\lib\\*'
}
}
unixScript.text = unixScript.text.replace('APP_HOME="`pwd -P`"', 'APP_HOME="`pwd -P`"\nJAVA_HOME_PLACEHOLDER')
unixScript.text = unixScript.text.replace('JAVA_HOME_PLACEHOLDER',
'if [ -d "$APP_HOME/jre1.8.0_72" ]; then\n' +
' JAVA_HOME="$APP_HOME/jre1.8.0_72"\n' +
' chmod u+x $JAVA_HOME/bin/*\n' +
'fi')
unixScript.text = unixScript.text.replace('CLASSPATH=', 'CLASSPATH=$APP_HOME/conf:')
unixScript.text = unixScript.text.replace('eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $API_GATEWAY_OPTS', 'eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $API_GATEWAY_OPTS\nexport APP_HOME');
unixScript.text = unixScript.text.replace('\\$', '$')
windowsScript.text = windowsScript.text.replace('%%', '%')
windowsScript.text = windowsScript.text.replace('set APP_HOME=%DIRNAME%..','set APP_HOME=%DIRNAME%..\nJAVA_HOME_PLACEHOLDER')
windowsScript.text = windowsScript.text.replace('JAVA_HOME_PLACEHOLDER','if exist "%APP_HOME%/jre1.8.0_72" set JAVA_HOME=%APP_HOME%/jre1.8.0_72')
windowsScript.text = windowsScript
.readLines()
.collect(configureWindowsClassPath)
.join('\r\n')
}
def windowsScripts = ['**/*.bat', '**/*.exe']
def linuxScripts = ['**/*.sh', '**/api-gateway', '**/api-gateway-service', '**/api-token-generator', '**/password-encoder']
distZip {
// To make sure that the use of apiTokenGeneratorStartScripts doesn't add duplicates to the zip file
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
baseName = "${qpApiGateway}"
}
distTar.enabled = false
/* Create os specific package zip files which included jre */
def dependencyDir = file(projectDir.path + '/deps')
def unzippedDir = file(buildDir.path + '/unzipped')
task copyGatewayDistributable(type: Copy, dependsOn: build) {
from zipTree(buildDir.path + '/distributions/' + "${qpApiGateway}" + "-" + version + ".zip")
into unzippedDir
}
task copyLinux64Java(type: Copy, dependsOn : copyGatewayDistributable) {
from zipTree(dependencyDir.path + "/jre-8u72-linux-x64.zip")
into unzippedDir.path + '/linux'
}
task copyWin64Java(type: Copy, dependsOn : copyGatewayDistributable) {
from zipTree(dependencyDir.path + "/jre-8u72-windows-x64.zip")
into unzippedDir.path + '/win'
}
task copyTrustStore(type: Copy, dependsOn: copyWin64Java) {
from unzippedDir.path + '/win/jre1.8.0_72/lib/security/cacerts'
into unzippedDir.path + "/${qpApiGateway}" + "-" + version + "/conf/"
rename ('cacerts', 'truststore.jks')
}
task buildDistGatewayWindows(type: Zip) {
from fileTree(unzippedDir.path + "/${qpApiGateway}" + "-" + version) {
exclude 'bin/curl.ermine'
exclude 'bin/*.sh'
exclude 'bin/api-gateway-service'
exclude 'bin/api-gateway'
exclude 'bin/api-token-generator'
exclude 'bin/install-api-gateway-service'
exclude 'bin/uninstall-api-gateway-service'
exclude 'bin/password-encoder'
into '/'
}
from (unzippedDir.path + '/win/jre1.8.0_72/.') {
into '/jre1.8.0_72'
}
baseName 'QP_APIGateway_win64'
}
buildDistGatewayWindows.dependsOn(copyWin64Java, copyTrustStore)
task buildDistGatewayLinux(type: Zip) {
from fileTree(unzippedDir.path + "/${qpApiGateway}" + "-" + version) {
exclude 'bin/*.bat'
exclude 'bin/*.exe'
into '/'
}
from (unzippedDir.path + '/linux/jre1.8.0_72/.') {
into '/jre1.8.0_72'
}
baseName 'QP_APIGateway_linux64'
}
buildDistGatewayLinux.dependsOn(copyLinux64Java, copyTrustStore)
task buildDistGatewayPackage << {
}
buildDistGatewayPackage.dependsOn(qpCommonGeoJar)
buildDistGatewayPackage.dependsOn(buildDistGatewayLinux)
buildDistGatewayPackage.dependsOn(buildDistGatewayWindows)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。