@@ -3,8 +3,9 @@ plugins {
33 id " java-library"
44 id " maven-publish"
55
6- id " org.sonarqube" version " 3.3"
7- id " com.diffplug.spotless" version " 6.12.0"
6+ id " org.sonarqube" version " 4.3.0.3225"
7+ id " com.diffplug.spotless" version " 6.19.0"
8+ id " io.github.gradle-nexus.publish-plugin" version " 1.3.0"
89}
910
1011repositories {
@@ -13,7 +14,8 @@ repositories {
1314}
1415
1516group = groupId
16- version = artifactVersion
17+ var ver = System . getenv(). getOrDefault(" RELEASE_VERSION" , artifactVersion)
18+ version = ver. startsWith(" v" ) ? ver. substring(1 ) : ver
1719
1820sourceCompatibility = JavaVersion . VERSION_1_8
1921targetCompatibility = JavaVersion . VERSION_1_8
@@ -28,6 +30,7 @@ dependencies {
2830}
2931
3032test {
33+ failFast(false )
3134 useJUnitPlatform()
3235 testLogging {
3336 events(" passed" , " skipped" , " failed" )
@@ -36,17 +39,21 @@ test {
3639 }
3740
3841 reports {
39- html. enabled( false )
40- junitXml. enabled( false )
42+ html. required = false
43+ junitXml. required = true
4144 }
45+
46+ environment([
47+ " " : " " ,
48+ ])
4249}
4350
4451spotless {
4552 java {
4653 encoding(" UTF-8" )
4754 importOrder()
4855 removeUnusedImports()
49- eclipse(" 4.21.0 " ). configFile(" ${ rootDir} /config/codestyle.xml" )
56+ eclipse(" 4.21" ). configFile(" ${ rootDir} /config/codestyle.xml" )
5057 }
5158}
5259
@@ -58,6 +65,18 @@ sonarqube {
5865 }
5966}
6067
68+ nexusPublishing {
69+ packageGroup = groupId
70+ repositories {
71+ sonatype {
72+ username = System . getenv(" OSS_USERNAME" )
73+ password = System . getenv(" OSS_PASSWORD" )
74+ nexusUrl. set(uri(" https://oss.sonatype.org/service/local/" ))
75+ snapshotRepositoryUrl. set(uri(" https://oss.sonatype.org/content/repositories/snapshots/" ))
76+ }
77+ }
78+ }
79+
6180publishing {
6281 publications {
6382 mavenJava(MavenPublication ) {
@@ -99,6 +118,16 @@ publishing {
99118 password System . getenv(" OSS_PASSWORD" )
100119 }
101120 }
121+ if (! version. endsWith(" SNAPSHOT" )) {
122+ maven {
123+ name = " GitHubPackages"
124+ url = " https://maven.pkg.github.com/GoodforGod/$artifactId "
125+ credentials {
126+ username = System . getenv(" GITHUB_ACTOR" )
127+ password = System . getenv(" GITHUB_TOKEN" )
128+ }
129+ }
130+ }
102131 }
103132}
104133
@@ -116,7 +145,7 @@ tasks.withType(JavaCompile) {
116145check. dependsOn jacocoTestReport
117146jacocoTestReport {
118147 reports {
119- xml. enabled true
148+ xml. required = true
120149 html. destination file(" ${ buildDir} /jacocoHtml" )
121150 }
122151}
@@ -128,9 +157,12 @@ javadoc {
128157 }
129158}
130159
131- if (project. hasProperty(" signing.keyId " )) {
160+ if (project. hasProperty(" signingKey " )) {
132161 apply plugin : " signing"
133162 signing {
163+ def signingKey = findProperty(" signingKey" )
164+ def signingPassword = findProperty(" signingPassword" )
165+ useInMemoryPgpKeys(signingKey, signingPassword)
134166 sign publishing. publications. mavenJava
135167 }
136168}
0 commit comments