Skip to content

Commit f3e6e70

Browse files
authored
Merge pull request #49 from siujamo/main
2 parents e6d8d78 + fc802b1 commit f3e6e70

File tree

22 files changed

+538
-106
lines changed

22 files changed

+538
-106
lines changed

build.gradle.kts

Lines changed: 1 addition & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -13,45 +13,4 @@
1313
*
1414
* See the License for the specific language governing permissions and
1515
* limitations under the License.
16-
*/
17-
18-
val logbackVersion: String by project
19-
val junitVersion: String by project
20-
val slf4jVersion: String by project
21-
val lombokVersion: String by project
22-
23-
subprojects {
24-
apply(plugin = "java")
25-
apply(plugin = "java-library")
26-
apply(plugin = "maven-publish")
27-
apply(plugin = "signing")
28-
29-
val implementation by configurations
30-
val testImplementation by configurations
31-
val compileOnly by configurations
32-
val annotationProcessor by configurations
33-
val testAnnotationProcessor by configurations
34-
val testCompileOnly by configurations
35-
36-
tasks.withType<Jar> {
37-
exclude("logback.xml")
38-
}
39-
40-
repositories {
41-
mavenCentral()
42-
}
43-
44-
dependencies {
45-
compileOnly("org.slf4j:slf4j-api:$slf4jVersion")
46-
implementation("ch.qos.logback:logback-classic:$logbackVersion")
47-
annotationProcessor("org.slf4j:slf4j-api:$slf4jVersion")
48-
49-
testCompileOnly("org.slf4j:slf4j-api:$slf4jVersion")
50-
testImplementation("org.junit.jupiter:junit-jupiter:$junitVersion")
51-
testAnnotationProcessor("org.slf4j:slf4j-api:$slf4jVersion")
52-
}
53-
54-
tasks.withType<JavaCompile> {
55-
options.encoding = "UTF-8"
56-
}
57-
}
16+
*/

devkit-bom/README.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# DevKit BOM
2+
3+
The devkit-bom (Bill of Materials) is a Maven POM file provided by OnixByte to manage dependency versions for the DevKit suite of libraries. By incorporating this BOM into your build configuration, you can ensure consistent versioning across all included dependencies without needing to specify versions explicitly in your project files. Published with Gradle metadata, this BOM supports both Maven and Gradle projects, and this document outlines how to integrate and use it effectively in both ecosystems.
4+
5+
## Using in Maven
6+
7+
Add the `devkit-bom` to your `pom.xml` under `<dependencyManagement>`:
8+
9+
```xml
10+
<dependencyManagement>
11+
<dependencies>
12+
<dependency>
13+
<groupId>com.onixbyte</groupId>
14+
<artifactId>devkit-bom</artifactId>
15+
<version>${devkit-version}</version>
16+
<type>pom</type>
17+
<scope>import</scope>
18+
</dependency>
19+
</dependencies>
20+
</dependencyManagement>
21+
```
22+
23+
Then reference dependencies like `devkit-core` without a version.
24+
25+
## Using in Gradle
26+
27+
In your `build.gradle[.kts]`, apply the BOM using the `platform` dependency:
28+
29+
```groovy
30+
dependencies {
31+
implementation platform('com.onixbyte:devkit-bom:2.0.0')
32+
implementation 'com.onixbyte:devkit-core'
33+
implementation 'com.onixbyte:devkit-utils'
34+
}
35+
```
36+
37+
If you are using Kotlin DSL:
38+
39+
```kotlin
40+
dependencies {
41+
implementation(platform("com.onixbyte:devkit-bom:2.0.0"))
42+
implementation("com.onixbyte:devkit-core")
43+
implementation("com.onixbyte:devkit-utils")
44+
}
45+
```
46+

devkit-bom/build.gradle.kts

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
/*
2+
* Copyright (C) 2024-2025 OnixByte.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
*
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
import java.net.URI
18+
19+
plugins {
20+
id("java-platform")
21+
id("maven-publish")
22+
id("signing")
23+
}
24+
25+
val artefactVersion: String by project
26+
val projectUrl: String by project
27+
val projectGithubUrl: String by project
28+
val licenseName: String by project
29+
val licenseUrl: String by project
30+
31+
group = "com.onixbyte"
32+
version = artefactVersion
33+
34+
repositories {
35+
mavenCentral()
36+
}
37+
38+
dependencies {
39+
constraints {
40+
api("com.onixbyte:devkit-core:$artefactVersion")
41+
api("com.onixbyte:devkit-utils:$artefactVersion")
42+
api("com.onixbyte:guid:$artefactVersion")
43+
api("com.onixbyte:key-pair-loader:$artefactVersion")
44+
api("com.onixbyte:map-util-unsafe:$artefactVersion")
45+
api("com.onixbyte:num4j:$artefactVersion")
46+
api("com.onixbyte:simple-jwt-facade:$artefactVersion")
47+
api("com.onixbyte:simple-jwt-authzero:$artefactVersion")
48+
api("com.onixbyte:simple-jwt-spring-boot-starter:$artefactVersion")
49+
api("com.onixbyte:property-guard-spring-boot-starter:$artefactVersion")
50+
api("com.onixbyte:simple-serial-spring-boot-starter:$artefactVersion")
51+
}
52+
}
53+
54+
publishing {
55+
publications {
56+
create<MavenPublication>("devkitBom") {
57+
groupId = group.toString()
58+
artifactId = "devkit-bom"
59+
version = artefactVersion
60+
61+
pom {
62+
name = "DevKit BOM"
63+
description = "Using BOM could use unified OnixByte JDevKit."
64+
url = projectUrl
65+
66+
licenses {
67+
license {
68+
name = licenseName
69+
url = licenseUrl
70+
}
71+
}
72+
73+
scm {
74+
connection = "scm:git:git://github.com:OnixByte/devkit-bom.git"
75+
developerConnection = "scm:git:git://github.com:OnixByte/devkit-bom.git"
76+
url = projectGithubUrl
77+
}
78+
79+
developers {
80+
developer {
81+
id = "zihluwang"
82+
name = "Zihlu Wang"
83+
email = "zihlu.wang@onixbyte.com"
84+
timezone = "Asia/Hong_Kong"
85+
}
86+
}
87+
}
88+
89+
print(components)
90+
91+
from(components["javaPlatform"])
92+
93+
signing {
94+
sign(publishing.publications["devkitBom"])
95+
}
96+
}
97+
98+
repositories {
99+
maven {
100+
name = "sonatypeNexus"
101+
url = URI(providers.gradleProperty("repo.maven-central.host").get())
102+
credentials {
103+
username = providers.gradleProperty("repo.maven-central.username").get()
104+
password = providers.gradleProperty("repo.maven-central.password").get()
105+
}
106+
}
107+
}
108+
}
109+
}

devkit-core/build.gradle.kts

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,15 @@
1414
* See the License for the specific language governing permissions and
1515
* limitations under the License.
1616
*/
17-
1817
import java.net.URI
1918

19+
plugins {
20+
java
21+
id("java-library")
22+
id("maven-publish")
23+
id("signing")
24+
}
25+
2026
val artefactVersion: String by project
2127
val projectUrl: String by project
2228
val projectGithubUrl: String by project
@@ -26,13 +32,37 @@ val licenseUrl: String by project
2632
group = "com.onixbyte"
2733
version = artefactVersion
2834

35+
repositories {
36+
mavenCentral()
37+
}
38+
2939
java {
3040
sourceCompatibility = JavaVersion.VERSION_17
3141
targetCompatibility = JavaVersion.VERSION_17
3242
withSourcesJar()
3343
withJavadocJar()
3444
}
3545

46+
tasks.withType<JavaCompile> {
47+
options.encoding = "UTF-8"
48+
}
49+
50+
tasks.withType<Jar> {
51+
exclude("logback.xml")
52+
}
53+
54+
dependencies {
55+
val slf4jVersion: String by project
56+
val logbackVersion: String by project
57+
val junitVersion: String by project
58+
59+
compileOnly("org.slf4j:slf4j-api:$slf4jVersion")
60+
implementation("ch.qos.logback:logback-classic:$logbackVersion")
61+
62+
testCompileOnly("org.slf4j:slf4j-api:$slf4jVersion")
63+
testImplementation("org.junit.jupiter:junit-jupiter:$junitVersion")
64+
}
65+
3666
tasks.test {
3767
useJUnitPlatform()
3868
}

devkit-utils/build.gradle.kts

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,15 @@
1414
* See the License for the specific language governing permissions and
1515
* limitations under the License.
1616
*/
17-
1817
import java.net.URI
1918

19+
plugins {
20+
java
21+
id("java-library")
22+
id("maven-publish")
23+
id("signing")
24+
}
25+
2026
val artefactVersion: String by project
2127
val projectUrl: String by project
2228
val projectGithubUrl: String by project
@@ -26,8 +32,8 @@ val licenseUrl: String by project
2632
group = "com.onixbyte"
2733
version = artefactVersion
2834

29-
dependencies {
30-
implementation(project(":devkit-core"))
35+
repositories {
36+
mavenCentral()
3137
}
3238

3339
java {
@@ -37,6 +43,27 @@ java {
3743
withJavadocJar()
3844
}
3945

46+
tasks.withType<JavaCompile> {
47+
options.encoding = "UTF-8"
48+
}
49+
50+
tasks.withType<Jar> {
51+
exclude("logback.xml")
52+
}
53+
54+
dependencies {
55+
val slf4jVersion: String by project
56+
val logbackVersion: String by project
57+
val junitVersion: String by project
58+
59+
compileOnly("org.slf4j:slf4j-api:$slf4jVersion")
60+
implementation("ch.qos.logback:logback-classic:$logbackVersion")
61+
implementation(project(":devkit-core"))
62+
63+
testCompileOnly("org.slf4j:slf4j-api:$slf4jVersion")
64+
testImplementation("org.junit.jupiter:junit-jupiter:$junitVersion")
65+
}
66+
4067
tasks.test {
4168
useJUnitPlatform()
4269
}

gradle.properties

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,16 @@
1515
# limitations under the License.
1616
#
1717

18+
artefactVersion=2.0.0
19+
projectUrl=https://onixbyte.com/JDevKit
20+
projectGithubUrl=https://github.com/OnixByte/JDevKit
21+
licenseName=The Apache License, Version 2.0
22+
licenseUrl=https://www.apache.org/licenses/LICENSE-2.0.txt
23+
1824
jacksonVersion=2.18.2
1925
javaJwtVersion=4.4.0
2026
junitVersion=5.11.4
2127
logbackVersion=1.5.16
2228
slf4jVersion=2.0.16
2329
springVersion=6.2.2
24-
springBootVersion=3.4.2
25-
26-
artefactVersion=2.0.0
27-
projectUrl=https://onixbyte.com/JDevKit
28-
projectGithubUrl=https://github.com/OnixByte/JDevKit
29-
licenseName=The Apache License, Version 2.0
30-
licenseUrl=https://www.apache.org/licenses/LICENSE-2.0.txt
30+
springBootVersion=3.4.2

guid/build.gradle.kts

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,15 @@
1414
* See the License for the specific language governing permissions and
1515
* limitations under the License.
1616
*/
17-
1817
import java.net.URI
1918

19+
plugins {
20+
java
21+
id("java-library")
22+
id("maven-publish")
23+
id("signing")
24+
}
25+
2026
val artefactVersion: String by project
2127
val projectUrl: String by project
2228
val projectGithubUrl: String by project
@@ -26,8 +32,8 @@ val licenseUrl: String by project
2632
group = "com.onixbyte"
2733
version = artefactVersion
2834

29-
dependencies {
30-
implementation(project(":devkit-core"))
35+
repositories {
36+
mavenCentral()
3137
}
3238

3339
java {
@@ -37,6 +43,27 @@ java {
3743
withJavadocJar()
3844
}
3945

46+
tasks.withType<JavaCompile> {
47+
options.encoding = "UTF-8"
48+
}
49+
50+
tasks.withType<Jar> {
51+
exclude("logback.xml")
52+
}
53+
54+
dependencies {
55+
val slf4jVersion: String by project
56+
val logbackVersion: String by project
57+
val junitVersion: String by project
58+
59+
compileOnly("org.slf4j:slf4j-api:$slf4jVersion")
60+
implementation("ch.qos.logback:logback-classic:$logbackVersion")
61+
implementation(project(":devkit-core"))
62+
63+
testCompileOnly("org.slf4j:slf4j-api:$slf4jVersion")
64+
testImplementation("org.junit.jupiter:junit-jupiter:$junitVersion")
65+
}
66+
4067
tasks.test {
4168
useJUnitPlatform()
4269
}

0 commit comments

Comments
 (0)