Skip to content

Commit 1392ad3

Browse files
committed
update gradle config and migrate to java 17
1 parent dbfa9ce commit 1392ad3

13 files changed

Lines changed: 336 additions & 269 deletions

File tree

build.gradle

Lines changed: 104 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -1,125 +1,127 @@
1-
rootProject.version = '9.9.1'
2-
group = 'com.spaceshift'
1+
rootProject.version = '9.9.2'
2+
group = 'javasabr'
33

44
allprojects {
55

6-
repositories {
7-
mavenCentral()
6+
repositories {
7+
mavenCentral()
8+
}
9+
10+
apply plugin: "java-library"
11+
apply plugin: "java-test-fixtures"
12+
apply plugin: 'maven-publish'
13+
14+
sourceCompatibility = JavaVersion.VERSION_17
15+
targetCompatibility = JavaVersion.VERSION_17
16+
17+
javadoc {
18+
failOnError = false
19+
}
20+
21+
test {
22+
useJUnitPlatform()
23+
}
24+
25+
dependencies {
26+
compileOnly libs.jetbrains.annotations
27+
compileOnly libs.lombok
28+
annotationProcessor libs.lombok
29+
30+
testImplementation libs.junit.api
31+
testCompileOnly libs.lombok
32+
testCompileOnly libs.jetbrains.annotations
33+
testRuntimeOnly libs.junit.engine
34+
testAnnotationProcessor libs.lombok
35+
}
36+
37+
/*compileJava {
38+
inputs.property("moduleName", jar.baseName)
39+
doFirst {
40+
options.compilerArgs = [
41+
'--module-path', classpath.asPath,
42+
]
43+
classpath = files()
44+
}
45+
}*/
46+
47+
compileJava {
48+
options.encoding = "UTF-8"
49+
}
50+
51+
compileTestJava {
52+
options.encoding = "UTF-8"
53+
}
54+
55+
tasks.withType(Javadoc).configureEach {
56+
options.encoding = "UTF-8"
57+
}
58+
59+
task sourcesJar(type: Jar, dependsOn: classes) {
60+
afterEvaluate {
61+
getArchiveClassifier().set("sources")
62+
getArchiveBaseName().set(jar.getArchiveBaseName())
63+
from sourceSets.main.allSource
864
}
65+
}
966

10-
apply plugin: "java-library"
11-
apply plugin: "java-test-fixtures"
12-
apply plugin: 'maven-publish'
13-
14-
sourceCompatibility = JavaVersion.VERSION_11
15-
targetCompatibility = JavaVersion.VERSION_11
16-
17-
javadoc {
18-
failOnError = false
67+
task javadocJar(type: Jar, dependsOn: javadoc) {
68+
afterEvaluate {
69+
getArchiveClassifier().set("javadoc")
70+
getArchiveBaseName().set(jar.getArchiveBaseName())
71+
from sourceSets.main.allSource
1972
}
73+
}
2074

21-
test {
22-
useJUnitPlatform()
23-
}
24-
25-
dependencies {
26-
compileOnly libs.jetbrains.annotations
27-
compileOnly libs.lombok
28-
annotationProcessor libs.lombok
29-
30-
testImplementation libs.junit.api
31-
testCompileOnly libs.lombok
32-
testCompileOnly libs.jetbrains.annotations
33-
testRuntimeOnly libs.junit.engine
34-
testAnnotationProcessor libs.lombok
35-
}
36-
37-
/*compileJava {
38-
inputs.property("moduleName", jar.baseName)
39-
doFirst {
40-
options.compilerArgs = [
41-
'--module-path', classpath.asPath,
42-
]
43-
classpath = files()
75+
publishing {
76+
repositories {
77+
maven {
78+
name = "GitlabPackages"
79+
url = uri("https://gitlab.com/api/v4/projects/37512056/packages/maven")
80+
credentials(HttpHeaderCredentials) {
81+
name = "Private-Token"
82+
value = project.findProperty("gitlab.token") ?: System.getenv("GITLAB_TOKEN")
4483
}
45-
}*/
46-
47-
compileJava {
48-
options.encoding = "UTF-8"
49-
}
50-
51-
compileTestJava {
52-
options.encoding = "UTF-8"
53-
}
54-
55-
tasks.withType(Javadoc) {
56-
options.encoding = "UTF-8"
57-
}
58-
59-
task sourcesJar(type: Jar, dependsOn: classes) {
60-
afterEvaluate {
61-
getArchiveClassifier().set("sources")
62-
getArchiveBaseName().set(jar.getArchiveBaseName())
63-
from sourceSets.main.allSource
84+
authentication {
85+
header(HttpHeaderAuthentication)
6486
}
87+
}
6588
}
6689

67-
task javadocJar(type: Jar, dependsOn: javadoc) {
90+
publications {
91+
mavenJava(MavenPublication) {
92+
from components.java
93+
version = rootProject.version
6894
afterEvaluate {
69-
getArchiveClassifier().set("javadoc")
70-
getArchiveBaseName().set(jar.getArchiveBaseName())
71-
from sourceSets.main.allSource
72-
}
73-
}
74-
75-
publishing {
76-
repositories {
77-
maven {
78-
name = "GitlabPackages"
79-
url = uri("https://gitlab.com/api/v4/projects/37512056/packages/maven")
80-
credentials(HttpHeaderCredentials) {
81-
name = "Private-Token"
82-
value = project.findProperty("gitlab.token") ?: System.getenv("GITLAB_TOKEN")
83-
}
84-
authentication {
85-
header(HttpHeaderAuthentication)
86-
}
87-
}
88-
}
89-
90-
publications {
91-
mavenJava(MavenPublication) {
92-
from components.java
93-
artifact sourcesJar
94-
artifact javadocJar
95-
version = rootProject.version
96-
afterEvaluate {
97-
artifactId = jar.baseName
98-
groupId = rootProject.group
99-
}
100-
}
95+
artifactId = jar.archiveBaseName.get()
96+
groupId = rootProject.group
10197
}
98+
artifact sourcesJar
99+
artifact javadocJar
100+
}
102101
}
102+
}
103103

104-
configurations {
105-
testArtifacts.extendsFrom testRuntime
106-
}
104+
configurations {
105+
testArtifacts.extendsFrom testRuntime
106+
}
107107

108-
task testJar(type: Jar) {
109-
getArchiveClassifier().set("test")
110-
from sourceSets.test.output
111-
}
108+
tasks.register('testJar', Jar) {
109+
getArchiveClassifier().set("test")
110+
from sourceSets.test.output
111+
}
112112

113-
artifacts {
114-
testArtifacts testJar
115-
}
113+
artifacts {
114+
testArtifacts testJar
115+
}
116116

117-
tasks.withType(Test) {
118-
maxParallelForks = Runtime.runtime.availableProcessors()
117+
tasks.withType(Test).tap {
118+
configureEach {
119+
maxParallelForks = Runtime.runtime.availableProcessors()
119120
}
121+
}
120122
}
121123

122124
wrapper {
123-
gradleVersion = '7.4.2'
124-
distributionType = Wrapper.DistributionType.ALL
125+
gradleVersion = '8.11.1'
126+
distributionType = Wrapper.DistributionType.ALL
125127
}

gradle/wrapper/gradle-wrapper.jar

4.52 KB
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-all.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-all.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)