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+ useJUnit()
47+ testLogging {
48+ events " passed" , " skipped" , " failed"
49+ exceptionFormat " full"
50+ }
51+ }
52+
53+ tasks. withType(JavaCompile ) {
54+ options. encoding = ' UTF-8'
55+ options. incremental = true
56+ options. fork = true
57+ }
58+
59+ tasks. withType(Test ) {
60+ reports. html. enabled = false
61+ reports. junitXml. enabled = false
62+ }
63+
64+ java {
65+ withJavadocJar()
66+ withSourcesJar()
67+ }
68+
69+ publishing {
70+ publications {
71+ mavenJava(MavenPublication ) {
72+ from components. java
73+
74+ pom {
75+ name = ' Java Etherscan API'
76+ url = ' https://github.com/GoodforGod/java-etherscan-api'
77+ description = ' Library is a wrapper for EtherScan API.'
78+
79+ license {
80+ name = ' MIT License'
81+ url = ' https://github.com/GoodforGod/java-etherscan-api/blob/master/LICENSE'
82+ distribution = ' repo'
83+ }
84+
85+ developer {
86+ id = ' GoodforGod'
87+ name = ' Anton Kurako'
88+ email = ' goodforgod.dev@gmail.com'
89+ url = ' https://github.com/GoodforGod'
90+ }
91+
92+ scm {
93+ connection = ' scm:git:git://github.com/GoodforGod/java-etherscan-api.git'
94+ developerConnection = ' scm:git:ssh://GoodforGod/java-etherscan-api.git'
95+ url = ' https://github.com/GoodforGod/java-etherscan-api/tree/master'
96+ }
97+ }
98+ }
99+ }
100+ repositories {
101+ maven {
102+ def releasesRepoUrl = " https://oss.sonatype.org/service/local/staging/deploy/maven2"
103+ def snapshotsRepoUrl = " https://oss.sonatype.org/content/repositories/snapshots/"
104+ url = version. endsWith(' SNAPSHOT' ) ? snapshotsRepoUrl : releasesRepoUrl
105+ credentials {
106+ username System . getenv(" OSS_USERNAME" )
107+ password System . getenv(" OSS_PASSWORD" )
108+ }
109+ }
110+ }
111+ }
112+
113+ check. dependsOn jacocoTestReport
114+ jacocoTestReport {
115+ reports {
116+ xml. enabled true
117+ html. destination file(" ${ buildDir} /jacocoHtml" )
118+ }
119+ }
120+
121+ if (project. hasProperty(" signing.keyId" )) {
122+ apply plugin : ' signing'
123+ signing {
124+ sign publishing. publications. mavenJava
125+ }
126+ }
127+
128+ javadoc {
129+ options. encoding = " UTF-8"
130+ if (JavaVersion . current(). isJava9Compatible()) {
131+ options. addBooleanOption(' html5' , true )
132+ }
133+ }
0 commit comments