1 Star 0 Fork 88

itzy/DeFiBus

forked from WeBank/DeFiBus 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
build.gradle 8.23 KB
一键复制 编辑 原始数据 按行查看 历史
nanoxiong 提交于 2020-09-01 19:47 . Merge branch 'master' into test
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import java.util.concurrent.TimeUnit
buildscript {
repositories {
maven {
url "https://maven.aliyun.com/repository/public"
}
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
//classpath("net.sourceforge.pmd:pmd-java:5.4.1")
//classpath("com.puppycrawl.tools:checkstyle:6.16.1")
classpath("gradle.plugin.com.github.spotbugs.snom:spotbugs-gradle-plugin:4.0.7")
classpath('com.github.spotbugs:spotbugs:4.0.0')
}
}
allprojects {
apply plugin: 'java'
clean.doFirst {
delete 'build'
delete 'dist'
}
if (project.findProperty("snapshot") instanceof String) {
if (project.property("snapshot").toBoolean())
version = version + "-SNAPSHOT"
}
}
task tar(type: Tar) {
extension = 'tar.gz'
compression = Compression.GZIP
archiveName = project.name + '_' + project.version + '.' + extension
destinationDir = new File(projectDir, 'build')
into('/') {
from 'dist'
}
}
task zip(type: Zip) {
extension = 'zip'
archiveName = project.name + '_' + project.version + '.' + extension
destinationDir = new File(projectDir, 'build')
into('/') {
from 'dist'
}
}
subprojects {
apply plugin: "maven"
apply plugin: "eclipse"
apply plugin: "idea"
apply plugin: "project-reports"
apply plugin: "jacoco"
// apply plugin: "checkstyle"
apply plugin: "pmd"
apply plugin: 'com.github.spotbugs'
[compileJava, compileTestJava, javadoc]*.options*.encoding = 'UTF-8'
compileJava.options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
jacoco {
toolVersion = "0.8.5"
reportsDir = file("$buildDir/reports/jacoco")
}
jacocoTestReport {
// sourceSets sourceSets.main
// executionData files("$buildDir/jacoco/jacocoTest.exec")
reports {
xml.enabled false
csv.enabled false
html.destination file("${buildDir}/reports/jacoco")
}
}
// checkstyle {
// toolVersion = "8.32"
// ignoreFailures = true
// sourceSets = [sourceSets.main]
// configFile = 'conf/checkstyle.xml' as File
// showViolations true
// }
//
// tasks.withType(Checkstyle) {
// reports {
// xml.enabled false
// html.enabled true
// }
// }
spotbugs {
toolVersion = '4.0.2'
ignoreFailures = true
effort = "default"
reportLevel = "default"
showProgress = true
}
// tasks.withType(com.github.spotbugs.SpotBugsTask) {
// sourceDirs = [sourceSets.main]
// reports {
// xml.enabled = false
// html.enabled = true
// }
// }
spotbugsMain {
reports {
xml.enabled = false
html.enabled = true
}
}
spotbugsTest {
reports {
xml.enabled = false
html.enabled = true
}
}
tasks.withType(Pmd) {
reports {
xml.enabled = false
html.enabled = true
}
}
pmd {
consoleOutput = true
toolVersion = "6.23.0"
rulePriority = 5
ruleSets = ["category/java/errorprone.xml", "category/java/bestpractices.xml"]
ignoreFailures = true
}
List junit = [
"junit:junit:4.12"
]
List apache_commons = [
"org.apache.commons:commons-collections4:4.1",
"commons-beanutils:commons-beanutils:1.9.3",
"org.apache.commons:commons-lang3:3.6",
"commons-codec:commons-codec:1.10"
]
List logback = [
"org.slf4j:slf4j-api:1.7.30"
]
List guava = [
"com.google.guava:guava:29.0-jre"
]
List fastjson = [
"com.alibaba:fastjson:1.2.71"
]
List common_io = [
"commons-io:commons-io:2.4"
]
List assertj = [
"org.assertj:assertj-core:2.6.0"
]
List mock = [
// "org.mockito:mockito-core:1.10.19",
"org.mockito:mockito-core:2.23.0",
"org.powermock:powermock-module-junit4:2.0.2",
"org.powermock:powermock-api-mockito2:2.0.2",
]
dependencies {
compile apache_commons, guava, logback, fastjson, common_io
testCompile apache_commons, guava, logback, fastjson, common_io, junit, assertj, mock
runtime apache_commons, guava, logback, fastjson, common_io
}
jar {
manifest {
attributes("Specification-Version": project.version,
"Specification-Vendor": "WeBank, Inc.",
"Specification-Title": project.name,
"Implementation-Version": project.version,
"Implementation-Vendor": "WeBank, Inc.",
"Implementation-Title": project.name,
"Build-Jdk": project.findProperty("jdk")
)
}
}
task dist(dependsOn: ['jar']) {
doFirst {
new File(projectDir, '../dist/bin').mkdirs()
new File(projectDir, '../dist/apps').mkdirs()
new File(projectDir, '../dist/conf').mkdirs()
new File(projectDir, '../dist/lib').mkdirs()
}
doLast {
copy {
into('../dist/apps/')
from project.jar.getArchivePath()
}
copy {
into '../dist/lib'
from project.configurations.runtime
exclude '**/*.properties*'
exclude '**/*testng*.jar'
exclude '**/*powermock*.jar'
exclude '**/*mockito*.jar'
exclude '**/*junit*.jar'
exclude '**/*jacoco*.jar'
exclude '**/*log4j2.xml*'
exclude '**/spring-boot-devtools*.jar'
exclude '**/mumble-sdk-test*.jar'
exclude '**/defibus*.jar'
exclude '*log4j*.jar'
exclude 'commons-collections-3.2.2.jar'
}
copy {
into '../dist/bin'
from '../script'
}
copy {
into '../dist/conf'
from '../conf/'
}
}
}
javadoc {
source = sourceSets.main.java
classpath = configurations.compile
destinationDir = reporting.file("javadoc")
}
task packageJavadoc(type: Jar, dependsOn: ['javadoc']) {
from project.javadoc.destinationDir
classifier = 'javadoc'
}
task packageSources(type: Jar) {
from project.sourceSets.main.allSource
classifier = 'sources' // either here or in artifacts block
}
artifacts {
archives jar
archives packageJavadoc
archives packageSources
}
repositories {
maven { url "https://maven.aliyun.com/repository/public" }
mavenCentral()
}
configurations.all {
resolutionStrategy.cacheChangingModulesFor 0, TimeUnit.SECONDS
resolutionStrategy.cacheDynamicVersionsFor 0, TimeUnit.SECONDS
}
uploadArchives {
repositories {
mavenDeployer {
snapshotRepository(url: 'Your target repo address') {
authentication(userName: 'Your user name', password: 'Your password')
}
repository(url: 'Your target repo address') {
authentication(userName: 'Your user name', password: 'Your password')
}
}
}
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/itzyyyy/DeFiBus.git
git@gitee.com:itzyyyy/DeFiBus.git
itzyyyy
DeFiBus
DeFiBus
master

搜索帮助