From 02efa40173058960ee9c4e8b36a59a3fb1bd8195 Mon Sep 17 00:00:00 2001 From: Ben Fortuna Date: Sat, 24 Feb 2024 14:00:22 +1100 Subject: [PATCH] Added Java module support --- build.gradle | 36 +++++++++---------- gradle.properties | 15 ++++---- ical4j-connector-api/build.gradle | 4 +++ .../src/main/java/module-info.java | 13 +++++++ .../org/ical4j/connector/CardCollection.java | 3 +- ical4j-connector-dav/build.gradle | 15 +++++--- .../src/main/java/module-info.java | 20 +++++++++++ 7 files changed, 74 insertions(+), 32 deletions(-) create mode 100644 ical4j-connector-api/src/main/java/module-info.java create mode 100644 ical4j-connector-dav/src/main/java/module-info.java diff --git a/build.gradle b/build.gradle index 0f55a202..1fb1307e 100644 --- a/build.gradle +++ b/build.gradle @@ -1,17 +1,8 @@ -buildscript { - repositories { - mavenCentral() - } - dependencies { - classpath 'com.palantir.gradle.revapi:gradle-revapi:1.5.0' - } -} - plugins { id 'signing' id 'pl.allegro.tech.build.axion-release' version '1.13.6' id 'biz.aQute.bnd.builder' version "$bndVersion" apply false - id 'org.javamodularity.moduleplugin' version '1.8.10' apply false + id 'org.javamodularity.moduleplugin' version '1.8.13' apply false } scmVersion { @@ -30,11 +21,15 @@ scmVersion { } configure(subprojects) { + apply plugin: 'java' apply plugin: 'java-library' apply plugin: 'maven-publish' apply plugin: 'groovy' apply plugin: 'biz.aQute.bnd.builder' -// apply plugin: 'org.javamodularity.moduleplugin' + apply plugin: 'org.javamodularity.moduleplugin' + + sourceCompatibility = 11 + targetCompatibility = 11 repositories { mavenCentral() @@ -44,9 +39,6 @@ configure(subprojects) { } } - sourceCompatibility = 8 - targetCompatibility = 8 - group = 'org.ical4j' description = '''\ A Java library for accessing iCalendar data stores @@ -63,10 +55,8 @@ A Java library for accessing iCalendar data stores } dependencies { - api "org.mnode.ical4j:ical4j:$ical4jVersion", - "org.mnode.ical4j:ical4j-vcard:$ical4jVCardVersion" - compileOnly 'org.osgi:osgi.core:8.0.0', + annotationProcessor 'org.osgi:osgi.core:8.0.0', 'org.osgi:org.osgi.service.component.annotations:1.5.0', 'org.osgi:org.osgi.service.metatype.annotations:1.4.1', 'org.osgi:org.osgi.annotation:6.0.0' @@ -77,7 +67,7 @@ A Java library for accessing iCalendar data stores "org.spockframework:spock-core" // junit - testImplementation "org.junit.vintage:junit-vintage-engine:$junitVintageVersion" +// testImplementation "org.junit.vintage:junit-vintage-engine:$junitVintageVersion" // testcontainers testImplementation "org.testcontainers:testcontainers:$testcontainersVersion", @@ -97,7 +87,17 @@ A Java library for accessing iCalendar data stores } } + compileTestJava { + moduleOptions { + compileOnClasspath = true + } + } + test { + moduleOptions { + runOnClasspath = true + } + useJUnitPlatform() } diff --git a/gradle.properties b/gradle.properties index 267c4496..0dfdd178 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,18 +1,19 @@ -ical4jVersion = 4.0.0-rc3 -ical4jVCardVersion = 2.0.0-beta2 +ical4jVersion = 4.0.0-rc4 +ical4jVCardVersion = 2.0.0-beta3 -jackrabbitWebdavVersion = 2.21.21 -jackrabbitCoreVersion = 2.21.21 +httpclientVersion = 4.5.14 +jackrabbitWebdavVersion = 2.21.23 +jackrabbitCoreVersion = 2.21.23 groovyVersion=3.0.17 slf4jVersion = 2.0.7 log4jVersion = 2.20.0 openTracingVersion = 0.33.0 -joolVersion = 0.9.14 -jetbrainsVersion = 20.1.0 +joolVersion = 0.9.15 +jetbrainsVersion = 24.1.0 spockVersion = 2.4-M1-groovy-3.0 junitVintageVersion = 5.8.2 -testcontainersVersion = 1.16.2 +testcontainersVersion = 1.19.5 bndVersion = 6.1.0 revApiOldVersion = 1.0.5 diff --git a/ical4j-connector-api/build.gradle b/ical4j-connector-api/build.gradle index e69de29b..324b8b77 100644 --- a/ical4j-connector-api/build.gradle +++ b/ical4j-connector-api/build.gradle @@ -0,0 +1,4 @@ +dependencies { + api "org.mnode.ical4j:ical4j:$ical4jVersion", + "org.mnode.ical4j:ical4j-vcard:$ical4jVCardVersion" +} diff --git a/ical4j-connector-api/src/main/java/module-info.java b/ical4j-connector-api/src/main/java/module-info.java new file mode 100644 index 00000000..2a94666f --- /dev/null +++ b/ical4j-connector-api/src/main/java/module-info.java @@ -0,0 +1,13 @@ +module ical4j.connector.api { + requires java.base; + + requires transitive ical4j.core; + requires transitive ical4j.vcard; + + requires org.slf4j; + requires org.apache.commons.lang3; + + exports org.ical4j.connector; + exports org.ical4j.connector.local; + exports org.ical4j.connector.event; +} \ No newline at end of file diff --git a/ical4j-connector-api/src/main/java/org/ical4j/connector/CardCollection.java b/ical4j-connector-api/src/main/java/org/ical4j/connector/CardCollection.java index f0bdbf99..fa3d5ae1 100644 --- a/ical4j-connector-api/src/main/java/org/ical4j/connector/CardCollection.java +++ b/ical4j-connector-api/src/main/java/org/ical4j/connector/CardCollection.java @@ -37,7 +37,6 @@ import net.fortuna.ical4j.vcard.VCardList; import net.fortuna.ical4j.vcard.filter.VCardFilter; import net.fortuna.ical4j.vcard.property.Uid; -import org.ical4j.connector.local.LocalCalendarCollection; import org.slf4j.LoggerFactory; import java.util.ArrayList; @@ -121,7 +120,7 @@ default VCardList getCards(String... uids) throws FailedOperationException { try { cards.add(getCard(uid)); } catch (ObjectNotFoundException e) { - LoggerFactory.getLogger(LocalCalendarCollection.class).warn("Calendar not found: " + uid); + LoggerFactory.getLogger(CardCollection.class).warn("Calendar not found: " + uid); } } return new VCardList(cards); diff --git a/ical4j-connector-dav/build.gradle b/ical4j-connector-dav/build.gradle index b446a633..41013d54 100644 --- a/ical4j-connector-dav/build.gradle +++ b/ical4j-connector-dav/build.gradle @@ -1,8 +1,13 @@ dependencies { - api project(":ical4j-connector-api"), - "org.apache.jackrabbit:jackrabbit-webdav:$jackrabbitWebdavVersion", - "org.jetbrains:annotations:$jetbrainsVersion", - "org.jooq:jool-java-8:$joolVersion" + api project(':ical4j-connector-api'), + "org.jetbrains:annotations:$jetbrainsVersion", "org.jooq:jool-java-8:$joolVersion" - implementation 'javax.servlet:servlet-api:2.5' + api("org.apache.httpcomponents:httpclient:$httpclientVersion") { + exclude(group: 'commons-logging', module: 'commons-logging') + } + + api("org.apache.jackrabbit:jackrabbit-webdav:$jackrabbitWebdavVersion") { + exclude(group: 'org.apache.httpcomponents', module: 'httpclient') + } + implementation 'javax.servlet:servlet-api:2.5', 'org.hamcrest:hamcrest:2.2' } diff --git a/ical4j-connector-dav/src/main/java/module-info.java b/ical4j-connector-dav/src/main/java/module-info.java new file mode 100644 index 00000000..83c2de7d --- /dev/null +++ b/ical4j-connector-dav/src/main/java/module-info.java @@ -0,0 +1,20 @@ +module ical4j.connector.dav { + requires java.base; + requires java.xml; + + requires ical4j.connector.api; + + requires org.apache.httpcomponents.httpcore; + requires org.apache.httpcomponents.httpclient; + requires jackrabbit.webdav; + + requires org.slf4j; + requires static org.jetbrains.annotations; + requires static org.hamcrest; + + exports org.ical4j.connector.dav; + exports org.ical4j.connector.dav.method; + exports org.ical4j.connector.dav.property; + exports org.ical4j.connector.dav.request; + exports org.ical4j.connector.dav.response; +}