From 149ed65f718012721f64cbac1d0b199a087c3e83 Mon Sep 17 00:00:00 2001 From: Kevin Cooney Date: Sat, 31 Jan 2026 18:39:12 -0800 Subject: [PATCH 1/5] Migrate to gradle-maven-publish-plugin Followed https://vanniktech.github.io/gradle-maven-publish-plugin/central/ changing the plugin version from 0.36.0 to 0.34.0 to we don't need to upgrade gradle. Tested by running: ```shell $ ./gradlew clean publishToMavenLocal $ cd ~/.m2/repository $ ls -1 ls -1 com/team2813/*/2.0.0-rc-1/ ``` Output of `ls`: ```shell com/team2813/lib/2.0.0-rc-1/: lib-2.0.0-rc-1-javadoc.jar lib-2.0.0-rc-1-sources.jar lib-2.0.0-rc-1.jar lib-2.0.0-rc-1.module lib-2.0.0-rc-1.pom com/team2813/limelight/2.0.0-rc-1/: limelight-2.0.0-rc-1-javadoc.jar limelight-2.0.0-rc-1-sources.jar limelight-2.0.0-rc-1.jar limelight-2.0.0-rc-1.module limelight-2.0.0-rc-1.pom com/team2813/testing/2.0.0-rc-1/: testing-2.0.0-rc-1-javadoc.jar testing-2.0.0-rc-1-sources.jar testing-2.0.0-rc-1.jar testing-2.0.0-rc-1.module testing-2.0.0-rc-1.pom com/team2813/vision/2.0.0-rc-1/: vision-2.0.0-rc-1-javadoc.jar vision-2.0.0-rc-1-sources.jar vision-2.0.0-rc-1.jar vision-2.0.0-rc-1.module vision-2.0.0-rc-1.pom ``` --- .../groovy/java-common-conventions.gradle | 2 +- .../main/groovy/publishing-conventions.gradle | 47 +++++++++---------- lib/build.gradle | 23 ++++----- limelight/build.gradle | 33 ++++++------- testing/build.gradle | 33 ++++++------- vision/build.gradle | 33 ++++++------- 6 files changed, 77 insertions(+), 94 deletions(-) diff --git a/buildSrc/src/main/groovy/java-common-conventions.gradle b/buildSrc/src/main/groovy/java-common-conventions.gradle index 0f75e559..4ec7486e 100644 --- a/buildSrc/src/main/groovy/java-common-conventions.gradle +++ b/buildSrc/src/main/groovy/java-common-conventions.gradle @@ -114,7 +114,7 @@ spotless { javadoc { options { // CTRE (Phoenix 5 & 6) - links += "https://api.ctr-electronics.com/phoenix6/release/java/" + links += "https://api.ctr-electronics.com/phoenix6/stable/java/" // WPILib links += "https://github.wpilib.org/allwpilib/docs/release/java/" // REVLib diff --git a/buildSrc/src/main/groovy/publishing-conventions.gradle b/buildSrc/src/main/groovy/publishing-conventions.gradle index b22f05d2..26ffdf6f 100644 --- a/buildSrc/src/main/groovy/publishing-conventions.gradle +++ b/buildSrc/src/main/groovy/publishing-conventions.gradle @@ -1,32 +1,27 @@ -plugins { - id 'maven-publish' -} - version = '2.0.0-rc-2' -publishing { - publications { - lib2813(MavenPublication) { - groupId = 'com.team2813.lib2813' - from components.java - artifact sourceJar - pom { - licenses { - license { - name = 'The Apache License, Version 2.0' - url = 'http://www.apache.org/licenses/LICENSE-2.0.txt' - } - } - scm { - connection = 'scm:git:git://github.com/Prospect-Robotics/lib2813.git' - developerConnection = 'scm:git:git://github.com/Prospect-Robotics/lib2813.git' - url = 'https://github.com/Prospect-Robotics/lib2813' - } - organization { - name = 'FRC 2813 Gear Heads' - url = 'https://team2813.com' - } +mavenPublishing { + publishToMavenCentral() + if (gradle.startParameter.taskNames.any { it.contains('MavenCentral') }) { + signAllPublications() + } + + coordinates('com.team2813', project.name, project.version) + + pom { + inceptionYear = '2023' + url = 'https://github.com/Prospect-Robotics/lib2813' + licenses { + license { + name = 'The Apache License, Version 2.0' + url = 'http://www.apache.org/licenses/LICENSE-2.0.txt' + distribution = 'http://www.apache.org/licenses/LICENSE-2.0.txt' } } + scm { + url = 'https://github.com/Prospect-Robotics/lib2813' + connection = 'scm:git:git://github.com/Prospect-Robotics/lib2813.git' + developerConnection = 'scm:git:git://github.com/Prospect-Robotics/lib2813.git' + } } } diff --git a/lib/build.gradle b/lib/build.gradle index fb4f6e8b..7d8813bf 100644 --- a/lib/build.gradle +++ b/lib/build.gradle @@ -1,5 +1,6 @@ plugins { id 'java-common-conventions' + id 'com.vanniktech.maven.publish' version '0.34.0' id 'publishing-conventions' id 'edu.wpi.first.GradleRIO' version '2026.1.1' } @@ -37,19 +38,15 @@ tasks.named('test') { systemProperty 'junit.jupiter.extensions.autodetection.enabled', 'true' } -publishing { - publications { - lib2813(MavenPublication) { - pom { - name = '2813 Library' - description = 'Frequently reused code written by team 2813' - developers { - developer { - id = 'cuttestkittensrule' - name = 'Kyle' - email = 'mangoiscute95@gmail.com' - } - } +mavenPublishing { + pom { + name = '2813 Library' + description = 'Frequently reused code written by team 2813' + developers { + developer { + id = 'cuttestkittensrule' + name = 'Kyle' + email = 'mangoiscute95@gmail.com' } } } diff --git a/limelight/build.gradle b/limelight/build.gradle index 47449552..2b3cfbeb 100644 --- a/limelight/build.gradle +++ b/limelight/build.gradle @@ -1,5 +1,6 @@ plugins { id 'java-common-conventions' + id 'com.vanniktech.maven.publish' version '0.34.0' id 'publishing-conventions' id 'edu.wpi.first.GradleRIO' version '2026.1.1' } @@ -31,24 +32,20 @@ test { useJUnit() } -publishing { - publications { - lib2813(MavenPublication) { - pom { - name = '2813 Limelight Library' - description = 'Limelight utilities for FRC robots' - developers { - developer { - id = 'cuttestkittensrule' - name = 'Kyle' - email = 'mangoiscute95@gmail.com' - } - developer { - id = 'kcooney' - name = 'Kevin' - email = 'kcooney@gmail.com' - } - } +mavenPublishing { + pom { + name = '2813 Limelight Library' + description = 'Limelight utilities for FRC robots' + developers { + developer { + id = 'cuttestkittensrule' + name = 'Kyle' + email = 'mangoiscute95@gmail.com' + } + developer { + id = 'kcooney' + name = 'Kevin' + email = 'kcooney@gmail.com' } } } diff --git a/testing/build.gradle b/testing/build.gradle index 3a32db91..89f67172 100644 --- a/testing/build.gradle +++ b/testing/build.gradle @@ -1,5 +1,6 @@ plugins { id 'java-common-conventions' + id 'com.vanniktech.maven.publish' version '0.34.0' id 'publishing-conventions' id 'edu.wpi.first.GradleRIO' version '2026.1.1' } @@ -34,24 +35,20 @@ tasks.named('test') { systemProperty 'junit.jupiter.extensions.autodetection.enabled', 'true' } -publishing { - publications { - lib2813(MavenPublication) { - pom { - name = '2813 Testing Library' - description = 'Utilities for testing FRC robots' - developers { - developer { - id = 'cuttestkittensrule' - name = 'Kyle' - email = 'mangoiscute95@gmail.com' - } - developer { - id = 'kcooney' - name = 'Kevin' - email = 'kcooney@gmail.com' - } - } +mavenPublishing { + pom { + name = '2813 Testing Library' + description = 'Utilities for testing FRC robots' + developers { + developer { + id = 'cuttestkittensrule' + name = 'Kyle' + email = 'mangoiscute95@gmail.com' + } + developer { + id = 'kcooney' + name = 'Kevin' + email = 'kcooney@gmail.com' } } } diff --git a/vision/build.gradle b/vision/build.gradle index 28eb11de..cc51ef1b 100644 --- a/vision/build.gradle +++ b/vision/build.gradle @@ -1,5 +1,6 @@ plugins { id 'java-common-conventions' + id 'com.vanniktech.maven.publish' version '0.34.0' id 'publishing-conventions' id 'edu.wpi.first.GradleRIO' version '2026.1.1' } @@ -32,24 +33,20 @@ test { systemProperty 'junit.jupiter.extensions.autodetection.enabled', 'true' } -publishing { - publications { - lib2813(MavenPublication) { - pom { - name = '2813 Vision Library' - description = 'Utilities for location and vision for FRC robots' - developers { - developer { - id = 'cuttestkittensrule' - name = 'Kyle' - email = 'mangoiscute95@gmail.com' - } - developer { - id = 'kcooney' - name = 'Kevin' - email = 'kcooney@gmail.com' - } - } +mavenPublishing { + pom { + name = '2813 Vision Library' + description = 'Utilities for location and vision for FRC robots' + developers { + developer { + id = 'cuttestkittensrule' + name = 'Kyle' + email = 'mangoiscute95@gmail.com' + } + developer { + id = 'kcooney' + name = 'Kevin' + email = 'kcooney@gmail.com' } } } From 8943bb68624cc19194a067a3890f9f16ca94ae60 Mon Sep 17 00:00:00 2001 From: Kevin Cooney Date: Sun, 1 Feb 2026 13:28:38 -0800 Subject: [PATCH 2/5] Change groupID to `com.team2813.lib2813` Co-authored-by: cuttestkittensrule --- buildSrc/src/main/groovy/publishing-conventions.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildSrc/src/main/groovy/publishing-conventions.gradle b/buildSrc/src/main/groovy/publishing-conventions.gradle index 26ffdf6f..2f4e9e16 100644 --- a/buildSrc/src/main/groovy/publishing-conventions.gradle +++ b/buildSrc/src/main/groovy/publishing-conventions.gradle @@ -6,7 +6,7 @@ mavenPublishing { signAllPublications() } - coordinates('com.team2813', project.name, project.version) + coordinates('com.team2813.lib2813', project.name, project.version) pom { inceptionYear = '2023' From f19c535db912bff14a9717bb4e8021f330d4d3a7 Mon Sep 17 00:00:00 2001 From: Kevin Cooney Date: Sun, 1 Feb 2026 15:24:05 -0800 Subject: [PATCH 3/5] Specify Gradle Maven Publish Plugin in buildSrc/build.gradle --- buildSrc/build.gradle | 5 ++++- buildSrc/src/main/groovy/publishing-conventions.gradle | 4 ++++ lib/build.gradle | 1 - limelight/build.gradle | 1 - testing/build.gradle | 1 - vision/build.gradle | 1 - 6 files changed, 8 insertions(+), 5 deletions(-) diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle index 83faff04..232e7227 100644 --- a/buildSrc/build.gradle +++ b/buildSrc/build.gradle @@ -3,8 +3,11 @@ plugins { } dependencies { - // Spotless code formatter. + // Spotless code formatter - https://github.com/diffplug/spotless implementation('com.diffplug.spotless:com.diffplug.spotless.gradle.plugin:6.25.0') + + // Gradle Maven Publish Plugin - https://vanniktech.github.io/gradle-maven-publish-plugin/ + implementation('com.vanniktech.maven.publish.base:com.vanniktech.maven.publish.base.gradle.plugin:0.34.0') } repositories { diff --git a/buildSrc/src/main/groovy/publishing-conventions.gradle b/buildSrc/src/main/groovy/publishing-conventions.gradle index 2f4e9e16..f724de96 100644 --- a/buildSrc/src/main/groovy/publishing-conventions.gradle +++ b/buildSrc/src/main/groovy/publishing-conventions.gradle @@ -1,3 +1,7 @@ +plugins { + id 'com.vanniktech.maven.publish' +} + version = '2.0.0-rc-2' mavenPublishing { diff --git a/lib/build.gradle b/lib/build.gradle index 7d8813bf..d1338351 100644 --- a/lib/build.gradle +++ b/lib/build.gradle @@ -1,6 +1,5 @@ plugins { id 'java-common-conventions' - id 'com.vanniktech.maven.publish' version '0.34.0' id 'publishing-conventions' id 'edu.wpi.first.GradleRIO' version '2026.1.1' } diff --git a/limelight/build.gradle b/limelight/build.gradle index 2b3cfbeb..a4f1489c 100644 --- a/limelight/build.gradle +++ b/limelight/build.gradle @@ -1,6 +1,5 @@ plugins { id 'java-common-conventions' - id 'com.vanniktech.maven.publish' version '0.34.0' id 'publishing-conventions' id 'edu.wpi.first.GradleRIO' version '2026.1.1' } diff --git a/testing/build.gradle b/testing/build.gradle index 89f67172..97419232 100644 --- a/testing/build.gradle +++ b/testing/build.gradle @@ -1,6 +1,5 @@ plugins { id 'java-common-conventions' - id 'com.vanniktech.maven.publish' version '0.34.0' id 'publishing-conventions' id 'edu.wpi.first.GradleRIO' version '2026.1.1' } diff --git a/vision/build.gradle b/vision/build.gradle index cc51ef1b..3f79748e 100644 --- a/vision/build.gradle +++ b/vision/build.gradle @@ -1,6 +1,5 @@ plugins { id 'java-common-conventions' - id 'com.vanniktech.maven.publish' version '0.34.0' id 'publishing-conventions' id 'edu.wpi.first.GradleRIO' version '2026.1.1' } From 4b4e6edc489c1f85785a98dcf584f7464a768256 Mon Sep 17 00:00:00 2001 From: Kevin Cooney Date: Sun, 1 Feb 2026 15:33:53 -0800 Subject: [PATCH 4/5] Increase waitForListenerQueue() timeout --- .../com/team2813/lib2813/preferences/IsolatedPreferences.java | 4 ++-- .../testing/junit/jupiter/IsolatedNetworkTablesExtension.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/src/test/java/com/team2813/lib2813/preferences/IsolatedPreferences.java b/lib/src/test/java/com/team2813/lib2813/preferences/IsolatedPreferences.java index b9be8530..599656c0 100644 --- a/lib/src/test/java/com/team2813/lib2813/preferences/IsolatedPreferences.java +++ b/lib/src/test/java/com/team2813/lib2813/preferences/IsolatedPreferences.java @@ -43,9 +43,9 @@ protected void before() { @Override protected void after() { Preferences.setNetworkTableInstance(NetworkTableInstance.getDefault()); - if (!tempInstance.waitForListenerQueue(.2)) { + if (!tempInstance.waitForListenerQueue(.6)) { System.err.println( - "Timed out waiting for the NetworkTableInstance listener queue to empty (waited 200ms);" + "Timed out waiting for the NetworkTableInstance listener queue to empty (waited 600ms);" + " JVM may crash"); } tempInstance.close(); diff --git a/testing/src/main/java/com/team2813/lib2813/testing/junit/jupiter/IsolatedNetworkTablesExtension.java b/testing/src/main/java/com/team2813/lib2813/testing/junit/jupiter/IsolatedNetworkTablesExtension.java index 4b90a8a3..f7fe1228 100644 --- a/testing/src/main/java/com/team2813/lib2813/testing/junit/jupiter/IsolatedNetworkTablesExtension.java +++ b/testing/src/main/java/com/team2813/lib2813/testing/junit/jupiter/IsolatedNetworkTablesExtension.java @@ -71,9 +71,9 @@ public void afterEach(ExtensionContext context) { // This works around a race condition in WPILib where a listener registered by Preferences can // be called after the NetworkTableInstance was closed (see // https://github.com/wpilibsuite/allwpilib/issues/8215). - if (!data.testInstance.waitForListenerQueue(.2)) { + if (!data.testInstance.waitForListenerQueue(.6)) { System.err.println( - "Timed out waiting for the NetworkTableInstance listener queue to empty (waited 200ms);" + "Timed out waiting for the NetworkTableInstance listener queue to empty (waited 600ms);" + " JVM may crash"); } data.testInstance.close(); From e9420c1149017a9724fa33fcfee83732b692d6c7 Mon Sep 17 00:00:00 2001 From: Kevin Cooney Date: Sun, 1 Feb 2026 15:35:29 -0800 Subject: [PATCH 5/5] Update IsolatedPreferences to restore previous nt instance for Preferences --- .../team2813/lib2813/preferences/IsolatedPreferences.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/src/test/java/com/team2813/lib2813/preferences/IsolatedPreferences.java b/lib/src/test/java/com/team2813/lib2813/preferences/IsolatedPreferences.java index 599656c0..08acf270 100644 --- a/lib/src/test/java/com/team2813/lib2813/preferences/IsolatedPreferences.java +++ b/lib/src/test/java/com/team2813/lib2813/preferences/IsolatedPreferences.java @@ -26,6 +26,7 @@ */ final class IsolatedPreferences extends ExternalResource { private NetworkTableInstance tempInstance; + private NetworkTableInstance prevInstance; /** Gets the {@link NetworkTable} that contains the preference values. */ public NetworkTable getPreferencesTable() { @@ -34,7 +35,7 @@ public NetworkTable getPreferencesTable() { @Override protected void before() { - NetworkTableInstance.getDefault(); + prevInstance = Preferences.getNetworkTable().getInstance(); tempInstance = NetworkTableInstance.create(); tempInstance.startLocal(); Preferences.setNetworkTableInstance(tempInstance); @@ -42,7 +43,7 @@ protected void before() { @Override protected void after() { - Preferences.setNetworkTableInstance(NetworkTableInstance.getDefault()); + Preferences.setNetworkTableInstance(prevInstance); if (!tempInstance.waitForListenerQueue(.6)) { System.err.println( "Timed out waiting for the NetworkTableInstance listener queue to empty (waited 600ms);"