Skip to content

Commit 77d38ce

Browse files
Refactor build configuration to use plugin aliases and update dependencies
1 parent 8ab2da6 commit 77d38ce

File tree

3 files changed

+42
-11
lines changed

3 files changed

+42
-11
lines changed

build.gradle.kts

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
plugins {
2-
java
2+
`java-library`
3+
idea
34
`maven-publish`
45
signing
5-
id("io.github.gradle-nexus.publish-plugin") version "1.0.0"
6-
idea
6+
alias(libs.plugins.nexus.publish)
7+
alias(libs.plugins.ben.manes.versions)
78
}
89

910
group = "net.sf.robocode"
@@ -12,20 +13,22 @@ version = "1.3.0"
1213

1314
val ossrhUsername: String by project
1415
val ossrhPassword: String by project
16+
val javaToolchains = extensions.getByType<JavaToolchainService>()
1517

1618
repositories {
1719
mavenCentral()
1820
}
1921

2022
dependencies {
21-
implementation("org.apache.bcel:bcel:6.7.0")
23+
implementation(libs.bcel)
2224
}
2325

2426
java {
2527
toolchain {
2628
languageVersion.set(JavaLanguageVersion.of(8))
2729
}
28-
30+
sourceCompatibility = JavaVersion.VERSION_1_8
31+
targetCompatibility = JavaVersion.VERSION_1_8
2932
withJavadocJar()
3033
withSourcesJar()
3134
}
@@ -50,8 +53,8 @@ tasks {
5053
nexusPublishing {
5154
repositories {
5255
sonatype {
53-
nexusUrl.set(uri("https://oss.sonatype.org/service/local/"))//staging/deploy/maven2/
54-
snapshotRepositoryUrl.set(uri("https://oss.sonatype.org/content/repositories/snapshots/"))
56+
nexusUrl.set(uri("https://ossrh-staging-api.central.sonatype.com/service/local/"))
57+
snapshotRepositoryUrl.set(uri("https://central.sonatype.com/repository/maven-snapshots/"))
5558
stagingProfileId.set("c7f511545ccf8")
5659
username.set(ossrhUsername)
5760
password.set(ossrhPassword)
@@ -102,12 +105,11 @@ publishing {
102105
}
103106

104107
signing {
108+
useGpgCmd()
105109
sign(publishing.publications["mavenJava"])
106110
}
107111

108112
val initializeSonatypeStagingRepository by tasks.existing
109-
subprojects {
110-
initializeSonatypeStagingRepository {
111-
shouldRunAfter(tasks.withType<Sign>())
112-
}
113+
initializeSonatypeStagingRepository {
114+
shouldRunAfter(tasks.withType<Sign>())
113115
}

gradle/libs.versions.toml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
[versions]
2+
3+
nexus-publish = "2.0.0"
4+
ben-manes-versions = "0.53.0"
5+
bcel = "6.11.0"
6+
7+
[libraries]
8+
9+
bcel = { module = "org.apache.bcel:bcel", version.ref = "bcel" }
10+
11+
[bundles]
12+
13+
[plugins]
14+
15+
nexus-publish = { id = "io.github.gradle-nexus.publish-plugin", version.ref = "nexus-publish" }
16+
17+
# ./gradlew dependencyUpdates -Drevision=release
18+
ben-manes-versions = { id = "com.github.ben-manes.versions", version.ref = "ben-manes-versions" }

gradle/test-libs.versions.toml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[versions]
2+
3+
junit = "4.13.2"
4+
5+
[libraries]
6+
7+
junit = { module = "junit:junit", version.ref = "junit" }
8+
9+
[bundles]
10+
11+
[plugins]

0 commit comments

Comments
 (0)