Skip to content

Commit 4fdab43

Browse files
committed
Migrate the build system from Maven to Gradle
1 parent f6dc0d9 commit 4fdab43

File tree

15 files changed

+527
-343
lines changed

15 files changed

+527
-343
lines changed

.github/workflows/build_and_release.yml

Lines changed: 0 additions & 49 deletions
This file was deleted.

.github/workflows/release_to_maven.yml

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,21 @@ jobs:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- uses: actions/checkout@v4
14-
- name: Set up Maven Central Repository
14+
- name: Import GPG key
15+
run: |
16+
echo "$GPG_SIGNING_KEY_PW" | gpg --batch --import --yes --passphrase-fd 0 <(echo -n "$GPG_SIGNING_KEY" | base64 --decode)
17+
mkdir -p ~/.gradle
18+
echo -n "signing.gnupg.passphrase=${GPG_SIGNING_KEY_PW}" >> ~/.gradle/gradle.properties
19+
env:
20+
GPG_SIGNING_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
21+
GPG_SIGNING_KEY_PW: ${{ secrets.GPG_PASSPHRASE }}
22+
- name: Set up Java
1523
uses: actions/setup-java@v4
1624
with:
1725
java-version: '17'
1826
distribution: 'temurin'
19-
server-id: ossrh
20-
server-username: MAVEN_USERNAME
21-
server-password: MAVEN_PASSWORD
22-
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
23-
gpg-passphrase: MAVEN_GPG_PASSPHRASE
2427
- name: Publish package
25-
run: mvn deploy -B -DskipTests -Psign,deploy-central --no-transfer-progress
28+
run: gradle publishToSonatype closeSonatypeStagingRepository
2629
env:
27-
MAVEN_USERNAME: ${{ secrets.NEXUS_USERNAME }}
28-
MAVEN_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
29-
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
30+
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.NEXUS_USERNAME }}
31+
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.NEXUS_PASSWORD }}

.gitignore

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,12 @@
1111
.project
1212
.classpath
1313

14-
# Maven #
15-
target/
16-
pom.xml.versionsBackup
14+
# Gradle
15+
.gradle
16+
build/
17+
!gradle/wrapper/gradle-wrapper.jar
18+
!**/src/main/**/build/
19+
!**/src/test/**/build/
1720

1821
# IntelliJ Settings Files (https://intellij-support.jetbrains.com/hc/en-us/articles/206544839-How-to-manage-projects-under-Version-Control-Systems) #
1922
.idea/**/workspace.xml

.idea/compiler.xml

Lines changed: 1 addition & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/gradle.xml

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build.gradle

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
plugins {
2+
id 'java-library'
3+
id "io.github.gradle-nexus.publish-plugin" version "2.0.0"
4+
id 'maven-publish'
5+
id 'signing'
6+
}
7+
8+
repositories {
9+
mavenCentral()
10+
}
11+
12+
dependencies {
13+
api libs.org.purejava.tweetnacl.java
14+
api libs.org.json.json
15+
api libs.org.apache.commons.commons.lang3
16+
api libs.org.slf4j.slf4j.api
17+
testImplementation libs.org.junit.jupiter.junit.jupiter.api
18+
testImplementation libs.org.junit.jupiter.junit.jupiter.engine
19+
testImplementation libs.org.junit.jupiter.junit.jupiter
20+
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
21+
testImplementation libs.org.slf4j.slf4j.simple
22+
}
23+
24+
group = 'org.purejava'
25+
version = '1.2.8'
26+
description = 'A Java library to access KeePassXC via its build-in proxy.'
27+
java.sourceCompatibility = JavaVersion.VERSION_17
28+
29+
java {
30+
withSourcesJar()
31+
withJavadocJar()
32+
}
33+
34+
test {
35+
useJUnitPlatform()
36+
filter {
37+
includeTestsMatching "KeepassProxyAccessTest"
38+
}
39+
}
40+
41+
publishing {
42+
publications {
43+
mavenJava(MavenPublication) {
44+
from(components.java)
45+
pom {
46+
name = 'keepassxc-proxy-access'
47+
description = 'A Java library to access KeePassXC via its build-in proxy.'
48+
url = 'https://github.com/purejava/keepassxc-proxy-access'
49+
licenses {
50+
license {
51+
name = 'MIT License'
52+
url = 'https://opensource.org/licenses/MIT'
53+
}
54+
}
55+
developers {
56+
developer {
57+
id = 'purejava'
58+
name = 'Ralph Plawetzki'
59+
60+
}
61+
}
62+
scm {
63+
connection = 'scm:git:git://github.com/purejava/keepassxc-proxy-access.git'
64+
developerConnection = 'scm:git:ssh://github.com/purejava/keepassxc-proxy-access.git'
65+
url = 'https://github.com/purejava/keepassxc-proxy-access/tree/main'
66+
}
67+
}
68+
}
69+
}
70+
}
71+
72+
nexusPublishing {
73+
repositories {
74+
sonatype { //only for users registered in Sonatype after 24 Feb 2021
75+
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
76+
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
77+
username = sonatypeUsername
78+
password = sonatypePassword
79+
}
80+
}
81+
}
82+
83+
if (!version.toString().endsWith("-SNAPSHOT")) {
84+
signing {
85+
sign publishing.publications.mavenJava
86+
}
87+
}
88+
89+
javadoc {
90+
if(JavaVersion.current().isJava9Compatible()) {
91+
options.addBooleanOption('html5', true)
92+
}
93+
}
94+
95+
tasks.withType(JavaCompile) {
96+
options.encoding = 'UTF-8'
97+
}
98+
99+
tasks.withType(Javadoc) {
100+
options.encoding = 'UTF-8'
101+
}

gradle.properties

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# This file was generated by the Gradle 'init' task.
2+
# https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties
3+
4+
org.gradle.configuration-cache=false
5+
org.gradle.parallel=true
6+
org.gradle.caching=true
7+
8+
signing.keyId=ABC48776
9+
signing.secretKeyRingFile=/Users/ralph/.gnupg/secring.gpg
10+

gradle/libs.versions.toml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# This file was generated by the Gradle 'init' task.
2+
# https://docs.gradle.org/current/userguide/platforms.html#sub::toml-dependencies-format
3+
4+
[versions]
5+
org-apache-commons-commons-lang3 = "3.17.0"
6+
org-json-json = "20241224"
7+
org-junit-jupiter-junit-jupiter = "5.11.4"
8+
org-junit-jupiter-junit-jupiter-api = "5.11.4"
9+
org-junit-jupiter-junit-jupiter-engine = "5.11.4"
10+
org-purejava-tweetnacl-java = "1.1.2"
11+
org-slf4j-slf4j-api = "2.0.16"
12+
org-slf4j-slf4j-simple = "2.0.16"
13+
14+
[libraries]
15+
org-apache-commons-commons-lang3 = { module = "org.apache.commons:commons-lang3", version.ref = "org-apache-commons-commons-lang3" }
16+
org-json-json = { module = "org.json:json", version.ref = "org-json-json" }
17+
org-junit-jupiter-junit-jupiter = { module = "org.junit.jupiter:junit-jupiter", version.ref = "org-junit-jupiter-junit-jupiter" }
18+
org-junit-jupiter-junit-jupiter-api = { module = "org.junit.jupiter:junit-jupiter-api", version.ref = "org-junit-jupiter-junit-jupiter-api" }
19+
org-junit-jupiter-junit-jupiter-engine = { module = "org.junit.jupiter:junit-jupiter-engine", version.ref = "org-junit-jupiter-junit-jupiter-engine" }
20+
org-purejava-tweetnacl-java = { module = "org.purejava:tweetnacl-java", version.ref = "org-purejava-tweetnacl-java" }
21+
org-slf4j-slf4j-api = { module = "org.slf4j:slf4j-api", version.ref = "org-slf4j-slf4j-api" }
22+
org-slf4j-slf4j-simple = { module = "org.slf4j:slf4j-simple", version.ref = "org-slf4j-slf4j-simple" }

gradle/wrapper/gradle-wrapper.jar

42.6 KB
Binary file not shown.

0 commit comments

Comments
 (0)