1+ plugins {
2+ id ' jacoco'
3+ id ' java-library'
4+ id ' maven-publish'
5+
6+ id ' org.sonarqube' version ' 3.0'
7+ id ' com.diffplug.gradle.spotless' version ' 4.4.0'
8+ }
9+
10+ repositories {
11+ mavenLocal()
12+ mavenCentral()
13+ jcenter()
14+ }
15+
16+ group = groupId
17+ version = artifactVersion
18+
19+ sourceCompatibility = 1.8
20+ targetCompatibility = 1.8
21+
22+ spotless {
23+ java {
24+ encoding ' UTF-8'
25+ removeUnusedImports()
26+ eclipse(). configFile " ${ projectDir} /config/codestyle.xml"
27+ }
28+ }
29+
30+ sonarqube {
31+ properties {
32+ property ' sonar.host.url' , ' https://sonarcloud.io'
33+ property ' sonar.organization' , ' goodforgod'
34+ property ' sonar.projectKey' , ' GoodforGod_java-etherscan-api'
35+ }
36+ }
37+
38+ dependencies {
39+ implementation ' org.jetbrains:annotations:20.1.0'
40+ implementation ' com.google.code.gson:gson:2.8.6'
41+
42+ testImplementation ' junit:junit:4.13.1'
43+ }
44+
45+ test {
46+ failFast = true
47+
48+ useJUnit()
49+ testLogging {
50+ events " passed" , " skipped" , " failed"
51+ exceptionFormat " full"
52+ }
53+ }
54+
55+ tasks. withType(JavaCompile ) {
56+ options. encoding = ' UTF-8'
57+ options. incremental = true
58+ options. fork = true
59+ }
60+
61+ tasks. withType(Test ) {
62+ reports. html. enabled = false
63+ reports. junitXml. enabled = false
64+ }
65+
66+ java {
67+ withJavadocJar()
68+ withSourcesJar()
69+ }
70+
71+ publishing {
72+ publications {
73+ mavenJava(MavenPublication ) {
74+ from components. java
75+
76+ pom {
77+ name = ' Java Etherscan API'
78+ url = ' https://github.com/GoodforGod/java-etherscan-api'
79+ description = ' Library is a wrapper for EtherScan API.'
80+
81+ license {
82+ name = ' MIT License'
83+ url = ' https://github.com/GoodforGod/java-etherscan-api/blob/master/LICENSE'
84+ distribution = ' repo'
85+ }
86+
87+ developer {
88+ id = ' GoodforGod'
89+ name = ' Anton Kurako'
90+ email = ' goodforgod.dev@gmail.com'
91+ url = ' https://github.com/GoodforGod'
92+ }
93+
94+ scm {
95+ connection = ' scm:git:git://github.com/GoodforGod/java-etherscan-api.git'
96+ developerConnection = ' scm:git:ssh://GoodforGod/java-etherscan-api.git'
97+ url = ' https://github.com/GoodforGod/java-etherscan-api/tree/master'
98+ }
99+ }
100+ }
101+ }
102+ repositories {
103+ maven {
104+ def releasesRepoUrl = " https://oss.sonatype.org/service/local/staging/deploy/maven2"
105+ def snapshotsRepoUrl = " https://oss.sonatype.org/content/repositories/snapshots/"
106+ url = version. endsWith(' SNAPSHOT' ) ? snapshotsRepoUrl : releasesRepoUrl
107+ credentials {
108+ username System . getenv(" OSS_USERNAME" )
109+ password System . getenv(" OSS_PASSWORD" )
110+ }
111+ }
112+ }
113+ }
114+
115+ check. dependsOn jacocoTestReport
116+ jacocoTestReport {
117+ reports {
118+ xml. enabled true
119+ html. destination file(" ${ buildDir} /jacocoHtml" )
120+ }
121+ }
122+
123+ if (project. hasProperty(" signing.keyId" )) {
124+ apply plugin : ' signing'
125+ signing {
126+ sign publishing. publications. mavenJava
127+ }
128+ }
129+
130+ javadoc {
131+ options. encoding = " UTF-8"
132+ if (JavaVersion . current(). isJava9Compatible()) {
133+ options. addBooleanOption(' html5' , true )
134+ }
135+ }
0 commit comments