jenkinsci / gitlab-plugin

A Jenkins plugin for interfacing with GitLab
https://plugins.jenkins.io/gitlab-plugin/
GNU General Public License v2.0
1.44k stars 612 forks source link

Require Jenkins 2.401.3 or newer #1607

Closed MarkEWaite closed 8 months ago

MarkEWaite commented 8 months ago

Require Jenkins 2.401.3 or newer

Needed for the Jackson 2.16.1-373.ve709c6871598 release that removes Jackson 2 API constants used by this plugin.

https://github.com/jenkinsci/gitlab-plugin/issues/1605 notes that the CAMEL_CASE_TO_LOWER_CASE_WITH_UNDERSCORES constant needs to be replaced with SNAKE_CASE.

https://github.com/FasterXML/jackson-databind/pull/4162 removed those deprecated aliases in https://github.com/FasterXML/jackson-databind/commit/d7a1efc7f45af4f56c0df4eccb0244418b6428bb

This change is preparation for a dependency on Jackson 2 API 2.16.1.

Also switches to use the joda-time plugin instead of joda-time jar file.

Also increases the plugin version from 1.7.x to 1.8.0 so that users know that they need to install this version. Without this version, the "Test connection" button will continue to report errors unless the user downgrades their Jackson 2 API plugin to 2.15.2-*.

Testing done

Automated tests pass.

Interactive testing using this pull request shows the message:

Client error: Class com.fasterxml.jackson.databind.PropertyNamingStrategy does not have member field 'com.fasterxml.jackson.databind.PropertyNamingStrategy CAMEL_CASE_TO_LOWER_CASE_WITH_UNDERSCORES

When I replace the Jackson 2 API plugin 2.16.1 with Jackson 2 API plugin 2.15.2, then the "test connection" button reports success. That shows I can duplicate the problem that is fixed in

Submitter checklist

MarkEWaite commented 8 months ago

When the Jackson API dependency is in this plugin is temporarily force to 2.16.1, the compilation fails with the message:

[ERROR] /home/mwaite/hub/my-plugins/gitlab-plugin/src/main/java/com/dabsquared/gitlabjenkins/util/JsonUtil.java:[23,62] cannot find symbol
  symbol:   variable CAMEL_CASE_TO_LOWER_CASE_WITH_UNDERSCORES
  location: class com.fasterxml.jackson.databind.PropertyNamingStrategy
[ERROR] /home/mwaite/hub/my-plugins/gitlab-plugin/src/main/java/com/dabsquared/gitlabjenkins/gitlab/JacksonConfig.java:[21,66] cannot find symbol
  symbol:   variable CAMEL_CASE_TO_LOWER_CASE_WITH_UNDERSCORES
  location: class com.fasterxml.jackson.databind.PropertyNamingStrategy

The change I made to the pom.xml file to generate that was:

diff --git a/pom.xml b/pom.xml
index c025841..15fb504 100644
--- a/pom.xml
+++ b/pom.xml
@@ -159,6 +159,7 @@
     <dependency>
       <groupId>org.jenkins-ci.plugins</groupId>
       <artifactId>jackson2-api</artifactId>
+      <version>2.16.1-373.ve709c6871598</version>
     </dependency>
     <dependency>
       <groupId>org.jenkins-ci.plugins</groupId>