Skip to content

Commit

Permalink
Merge pull request #67 from WeBankFinTech/release/1.0.4
Browse files Browse the repository at this point in the history
Release/1.0.4
  • Loading branch information
yanggang-JV authored Sep 22, 2020
2 parents 292a1e2 + 4d06db0 commit 46cfcfb
Show file tree
Hide file tree
Showing 38 changed files with 663 additions and 283 deletions.
147 changes: 55 additions & 92 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
plugins {
id 'org.springframework.boot' version '2.2.2.RELEASE'
id 'io.spring.dependency-management' version '1.0.8.RELEASE'
id 'java'
}

def gradleVer = "4"
if (gradle.gradleVersion.startsWith("6")
|| gradle.gradleVersion.startsWith("5")
Expand All @@ -11,98 +17,92 @@ if (gradle.gradleVersion.startsWith("6")
println "Gradle with version < 4.7 detected"
}

buildscript {
repositories {
maven { url "https://plugins.gradle.org/m2/" }
}
dependencies {
//使用1.5.4.RELEASE版本的Spring框架
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.5.12.RELEASE")
classpath "gradle.plugin.com.github.spotbugs:spotbugs-gradle-plugin:1.6.5"
}
}

apply plugin: 'maven'
apply plugin: 'java'
apply plugin: 'application'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'
if (!gradle.startParameter.isOffline()) {
apply plugin: 'checkstyle'
apply plugin: 'jacoco'
apply plugin: "com.github.spotbugs"
apply plugin: 'signing'
}

version = "1.0.3"
def repo ="${repoType}"
//设置jdk的版本
sourceCompatibility = 1.8
targetCompatibility = 1.8

repositories {
if (!gradle.startParameter.isOffline()) {
mavenLocal()
mavenCentral()//依赖Maven仓库
maven { url "http://maven.aliyun.com/nexus/content/groups/public/" }
mavenLocal()
if ("cn" == repo) {
println "use cn repo"
maven {url "http://maven.aliyun.com/nexus/content/groups/public/"}
} else {
println "use default repo"
mavenCentral()
}
maven { url "https://dl.bintray.com/ethereum/maven/" }
maven { url "https://oss.sonatype.org/content/groups/public/" }
} else {
maven {
url 'dependencies'
}
}
}

def spring_version = "4.3.27.RELEASE"
def spring_version = "5.2.2.RELEASE"
def log4j_version = "2.13.3";
def slf4j_version = "1.7.30";
def jackson_version = "2.11.0";
def mysql_version = "8.0.20";
def swagger_version = "2.9.2";

List swagger = [
"io.springfox:springfox-swagger2:$swagger_version",
"io.springfox:springfox-swagger-ui:$swagger_version"
"io.springfox:springfox-swagger2:$swagger_version",
"io.springfox:springfox-swagger-ui:$swagger_version"
]

List apache_commons = [
"org.apache.logging.log4j:log4j-api:$log4j_version",
"org.apache.logging.log4j:log4j-web:$log4j_version",
"org.apache.logging.log4j:log4j-core:$log4j_version",
"org.apache.logging.log4j:log4j-jcl:$log4j_version",
"org.apache.logging.log4j:log4j-slf4j-impl:$log4j_version",
"org.slf4j:jul-to-slf4j:$slf4j_version",
"org.slf4j:slf4j-api:$slf4j_version"
"org.apache.logging.log4j:log4j-api:$log4j_version",
"org.apache.logging.log4j:log4j-web:$log4j_version",
"org.apache.logging.log4j:log4j-core:$log4j_version",
"org.apache.logging.log4j:log4j-jcl:$log4j_version",
"org.apache.logging.log4j:log4j-slf4j-impl:$log4j_version",
"org.slf4j:jul-to-slf4j:$slf4j_version",
"org.slf4j:slf4j-api:$slf4j_version"
]

List json = [
"com.fasterxml.jackson.datatype:jackson-datatype-jdk8:$jackson_version",
"com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version",
"com.fasterxml.jackson.module:jackson-module-parameter-names:$jackson_version",
"com.fasterxml.jackson.core:jackson-databind:$jackson_version",
"com.fasterxml.jackson.core:jackson-annotations:$jackson_version",
"com.fasterxml.jackson.core:jackson-core:$jackson_version",
"com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:$jackson_version"
"com.fasterxml.jackson.datatype:jackson-datatype-jdk8:$jackson_version",
"com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version",
"com.fasterxml.jackson.module:jackson-module-parameter-names:$jackson_version",
"com.fasterxml.jackson.core:jackson-databind:$jackson_version",
"com.fasterxml.jackson.core:jackson-annotations:$jackson_version",
"com.fasterxml.jackson.core:jackson-core:$jackson_version",
"com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:$jackson_version"
]

List mysql_driver = [
"mysql:mysql-connector-java:$mysql_version"
"mysql:mysql-connector-java:$mysql_version"
]

List spring = [
"org.springframework:spring-core:$spring_version",
"org.springframework:spring-beans:$spring_version",
"org.springframework:spring-context:$spring_version",
"org.springframework:spring-tx:$spring_version",
"org.springframework:spring-jdbc:$spring_version",
"org.springframework:spring-test:$spring_version",
"org.springframework:spring-context-support:$spring_version",
"org.springframework:spring-web:$spring_version",
"org.springframework:spring-webmvc:$spring_version"
"org.springframework:spring-core:$spring_version",
"org.springframework:spring-beans:$spring_version",
"org.springframework:spring-context:$spring_version",
"org.springframework:spring-tx:$spring_version",
"org.springframework:spring-jdbc:$spring_version",
"org.springframework:spring-test:$spring_version",
"org.springframework:spring-context-support:$spring_version",
"org.springframework:spring-web:$spring_version",
"org.springframework:spring-webmvc:$spring_version"
]

List other = [
"javassist:javassist:3.12.1.GA"
"javassist:javassist:3.12.1.GA"
]

configurations {
Expand All @@ -118,7 +118,7 @@ dependencies {
compile files('./dependencies/weid-java-sdk-pipeline.jar')
} else {
println "No pipeline jar found for WeIdentity Java SDK, using gradle version.."
compile("com.webank:weid-java-sdk:1.6.4") {
compile("com.webank:weid-java-sdk:1.6.5") {
exclude group:"org.slf4j", module: "slf4j-log4j12"
}
}
Expand All @@ -128,20 +128,22 @@ dependencies {
} else {
compile("org.springframework.boot:spring-boot-starter-web"){
exclude group:"ch.qos.logback"
exclude group:"org.apache.logging.log4j"
}
compile fileTree(dir:'libs', include:'*.jar')
compile apache_commons, swagger, json, mysql_driver, spring, other
compile apache_commons, swagger, json, mysql_driver, spring, other
}
}
if (gradleVer.startsWith("5")) {
if (gradleVer.startsWith("5")) {
if (!gradle.startParameter.isOffline()) {
compileOnly 'org.projectlombok:lombok:1.18.12'
annotationProcessor 'org.projectlombok:lombok:1.18.12'
compile("org.springframework.boot:spring-boot-starter-web"){
exclude group:"ch.qos.logback"
exclude group:"org.apache.logging.log4j"
}
compile fileTree(dir:'libs', include:'*.jar')
compile apache_commons, swagger, json, mysql_driver, spring, other
compile apache_commons, swagger, json, mysql_driver, spring, other
} else {
compileOnly files('dist/lib/lombok-1.18.12.jar')
annotationProcessor files('dist/lib/lombok-1.18.12.jar')
Expand All @@ -152,43 +154,21 @@ dependencies {

//生成的jar包包名和版本
jar {
enabled = true
baseName = 'weIdentity-sample'
destinationDir file('dist/app')
archiveName project.name + '.jar'

doFirst {
exclude '/*.*'
}

archiveName baseName+ '-' + version + '.jar'
exclude '/*.*'

doLast {
copy {
from file('src/main/resources/')
into 'dist/conf'
}
copy {
from file('keys')
into 'dist/keys'
}
copy {
from configurations.compile
into 'dist/lib'
}
copy {
from file('.').listFiles().findAll { File f -> (f.name.endsWith('.bat') || f.name.endsWith('.sh') || f.name.endsWith('.env')) }
into 'dist'
}
mkdir 'dist/logs'
}
}

mainClassName = 'com.webank.weid.demo.server.SampleApp'

build {
doLast {
delete "dist/app/" + project.name + ".jar"
file("dist/app/" + project.name + ".jar.original").renameTo("dist/app/" + project.name + ".jar")
print project.name
}
}

clean {
delete("dist")
Expand All @@ -215,20 +195,3 @@ tasks.withType(Checkstyle) {
html.enabled true
}
}

spotbugs {
ignoreFailures = true
showProgress = true
toolVersion = "3.1.8"
effort = "max"
reportLevel = "low"
excludeFilter = file("${project.rootDir}/config/spotbugs/spotbugs_filter.xml")
}

tasks.withType(com.github.spotbugs.SpotBugsTask) {
reports {
xml.enabled false
html.enabled true
html.stylesheet resources.text.fromFile('config/spotbugs.xsl')
}
}
11 changes: 9 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,21 @@

echo "begin to build weidentity-sample."

gradle clean build -x checkMain
if [ -n "$1" ] ;then
sed -i "/^repoType/crepoType=$1" gradle.properties
fi

#build
chmod u+x gradlew

./gradlew clean build -x checkMain
if [[ $? -ne 0 ]];then
echo "gradle build weidentity-sample failed"
exit 1
fi
echo "build weidentity-sample success."
cp -fr libs/* dist/lib/

touch dist/logs/all.log
mkdir -p logs

exit 0
4 changes: 2 additions & 2 deletions command.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ if [[ "$1" == daemon ]];then
exit 1
fi

java ${JAVA_OPTS} -cp dist/conf/:dist/lib/*:dist/app/* com.webank.weid.demo.command.DemoCommand $1 >/dev/null 2>&1 &
java ${JAVA_OPTS} -cp dist/app/*:resources/:dist/lib/* com.webank.weid.demo.command.DemoCommand $1 >/dev/null 2>&1 &

sleep 2

Expand All @@ -36,6 +36,6 @@ if [[ "$1" == daemon ]];then

else
echo "--------- start $1 ----------"
java ${JAVA_OPTS} -cp dist/conf/:dist/lib/*:dist/app/* com.webank.weid.demo.command.DemoCommand $1
java ${JAVA_OPTS} -cp dist/app/*:resources/:dist/lib/* com.webank.weid.demo.command.DemoCommand $1
fi

3 changes: 2 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
org.gradle.jvmargs='-Dfile.encoding=UTF-8'
org.gradle.jvmargs='-Dfile.encoding=UTF-8'
repoType=cn
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
5 changes: 5 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 46cfcfb

Please sign in to comment.