Skip to content

Commit

Permalink
plugin modernization to reduce hpi size (#355)
Browse files Browse the repository at this point in the history
* plugin modernization

- use 2.452.4 as minimum Jenkins version
- replace dependency to jackson, gson and commons-lang3 with the
  corresponding api plugins
- remove dependency to groovy. It is not needed and only blows up the hpi.
- remove dependencies to annotation-indexer and structs as they are not
  required

* suppress spotbugs warnings

---------

Co-authored-by: Christian Del Monte <christian.del-monte@posteo.de>
  • Loading branch information
mawinter69 and cdelmonte-zg authored Feb 26, 2025
1 parent 38686bb commit e84c2ba
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 39 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,12 @@

# Compatibility

**Starting from version 3.x.x** the Plugin is compatible with:
**Starting from version 3.2.0** the Plugin is compatible with:

- Jenkins version: >= **2.401.3**
- Java version: **11**

**Starting from version 3.0.0** the Plugin is compatible with:

- Jenkins version: >= **2.361.4**
- Java version: **11**
Expand Down
58 changes: 23 additions & 35 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>4.53</version>
<version>4.88</version>
<relativePath />
</parent>

<groupId>io.jenkins.plugins</groupId>
<artifactId>bitbucket-push-and-pull-request</artifactId>
<version>3.1.6-SNAPSHOT</version>
<version>3.2.0-SNAPSHOT</version>
<packaging>hpi</packaging>

<properties>
<!-- https://www.jenkins.io/doc/developer/plugin-development/choosing-jenkins-baseline/ -->
<jenkins.baseline>2.361</jenkins.baseline>
<jenkins.version>${jenkins.baseline}.4</jenkins.version>
<jenkins.baseline>2.401</jenkins.baseline>
<jenkins.version>${jenkins.baseline}.3</jenkins.version>
<powermock.version>2.0.0</powermock.version>
<hpi.compatibleSinceVersion>2.9.0</hpi.compatibleSinceVersion>
<!-- Readd to enable Java 17 -->
Expand Down Expand Up @@ -53,18 +53,14 @@
<dependency>
<groupId>io.jenkins.tools.bom</groupId>
<artifactId>bom-${jenkins.baseline}.x</artifactId>
<version>1750.v0071fa_4c4a_e3</version>
<version>2745.vc7b_fe4c876fa_</version>
<scope>import</scope>
<type>pom</type>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>structs</artifactId>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>git</artifactId>
Expand All @@ -81,10 +77,6 @@
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-api</artifactId>
</dependency>
<dependency>
<groupId>org.jenkins-ci</groupId>
<artifactId>annotation-indexer</artifactId>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plain-credentials</artifactId>
Expand All @@ -102,42 +94,38 @@
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>job-dsl</artifactId>
<version>1.81.1</version>
<version>1.87</version>
</dependency>

<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.10.1</version>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>2.4.21</version>
<groupId>io.jenkins.plugins</groupId>
<artifactId>gson-api</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.12.0</version>
<groupId>io.jenkins.plugins</groupId>
<artifactId>commons-lang3-api</artifactId>
</dependency>
<dependency>
<groupId>com.github.scribejava</groupId>
<artifactId>scribejava-core</artifactId>
<version>8.3.3</version>
<exclusions>
<!-- loaded via jackson2-api plugin -->
<exclusion>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>*</artifactId>
</exclusion>
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>

<!-- Added to avoid transitive dependency via scribejava-core-->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.14.0</version>
</dependency>

<!-- Added to avoid transitive dependency via scribejava-core-->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.14.0</version>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>jackson2-api</artifactId>
</dependency>

<!-- JCasC compatibility -->
Expand Down
5 changes: 5 additions & 0 deletions src/spotbugs/excludesFilter.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<FindBugsFilter>
<Match>
<Bug pattern="PA_PUBLIC_PRIMITIVE_ATTRIBUTE" />
</Match>
</FindBugsFilter>
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@
import org.jvnet.hudson.test.JenkinsRule;
import org.mockito.junit.jupiter.MockitoExtension;

import com.gargoylesoftware.htmlunit.HttpMethod;
import com.gargoylesoftware.htmlunit.WebRequest;
import com.gargoylesoftware.htmlunit.WebResponse;
import org.htmlunit.HttpMethod;
import org.htmlunit.WebRequest;
import org.htmlunit.WebResponse;

@ExtendWith(MockitoExtension.class)
public class BitBucketPPRCrumbExclusionTest {
Expand Down

0 comments on commit e84c2ba

Please sign in to comment.