Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reproduce an issue with optional dependencies of detached plugins #1677

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 4 additions & 19 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>5.1</version>
<version>4.88</version>
<relativePath />
</parent>

Expand Down Expand Up @@ -66,10 +66,8 @@
<changelist>-SNAPSHOT</changelist>
<gitHubRepo>jenkinsci/${project.artifactId}-plugin</gitHubRepo>
<!-- https://www.jenkins.io/doc/developer/plugin-development/choosing-jenkins-baseline/ -->
<jenkins.baseline>2.479</jenkins.baseline>
<!-- TODO Replace with the standard jenkins.baseline references after LTS requires Java 17 -->
<!-- <jenkins.version>${jenkins.baseline}.1</jenkins.version> -->
<jenkins.version>${jenkins.baseline}</jenkins.version>
<jenkins.baseline>2.452</jenkins.baseline>
<jenkins.version>${jenkins.baseline}.4</jenkins.version>
<no-test-jar>false</no-test-jar>
<!-- Jenkins.MANAGE is still in Beta -->
<useBeta>true</useBeta>
Expand All @@ -78,6 +76,7 @@
<linkXRef>false</linkXRef>
<spotbugs.effort>Max</spotbugs.effort>
<spotbugs.threshold>Low</spotbugs.threshold>
<test>InjectedTest</test>
</properties>

<dependencyManagement>
Expand All @@ -89,13 +88,6 @@
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<!-- TODO: Remove when 2.14.0-133.vcc091215a_358 or newer is in BOM -->
<!-- https://github.com/jenkinsci/mina-sshd-api-plugin/releases/tag/2.14.0-133.vcc091215a_358 -->
<groupId>io.jenkins.plugins.mina-sshd-api</groupId>
<artifactId>mina-sshd-api-common</artifactId>
<version>2.14.0-133.vcc091215a_358</version>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
Expand All @@ -106,8 +98,6 @@
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>git-client</artifactId>
<!-- TODO: Remove when release is available in plugin BOM -->
<version>6.1.0</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
Expand All @@ -120,8 +110,6 @@
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>scm-api</artifactId>
<!-- TODO: Remove when release is available in plugin BOM -->
<version>698.v8e3b_c788f0a_6</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
Expand All @@ -145,9 +133,6 @@
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>matrix-project</artifactId>
<optional>true</optional>
<!-- pipeline-model-definition plugins fail to start git plugin in PCT for 2.440.x and 2.452.x lines -->
<!-- TODO: Remove once this workaround dependency downgrade is no longer required for PCT -->
<version>822.824.v14451b_c0fd42</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.NoExternalUse;
import org.kohsuke.stapler.HttpResponse;
import org.kohsuke.stapler.StaplerRequest2;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.interceptor.RequirePOST;

import java.io.Serializable;
Expand Down Expand Up @@ -58,7 +58,7 @@ public GlobalConfigurationCategory getCategory() {
}

@RequirePOST
public HttpResponse doGenerate(StaplerRequest2 req) {
public HttpResponse doGenerate(StaplerRequest req) {
Jenkins.get().checkPermission(Jenkins.ADMINISTER);

String apiTokenName = req.getParameter("apiTokenName");
Expand Down Expand Up @@ -102,7 +102,7 @@ private static byte[] hashedBytes(byte[] tokenBytes) {
}

@RequirePOST
public HttpResponse doRevoke(StaplerRequest2 req) {
public HttpResponse doRevoke(StaplerRequest req) {
Jenkins.get().checkPermission(Jenkins.ADMINISTER);

String apiTokenUuid = req.getParameter("apiTokenUuid");
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/hudson/plugins/git/GitPublisher.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import org.jenkinsci.plugins.gitclient.UnsupportedCommand;
import org.kohsuke.stapler.*;

import jakarta.servlet.ServletException;
import javax.servlet.ServletException;
import java.io.IOException;
import java.io.Serializable;
import java.util.ArrayList;
Expand Down Expand Up @@ -437,7 +437,7 @@ public FormValidation doCheckNoteMsg(@QueryParameter String value) {
}

public FormValidation doCheckRemote(
@AncestorInPath AbstractProject project, StaplerRequest2 req)
@AncestorInPath AbstractProject project, StaplerRequest req)
throws IOException, ServletException {
String remote = req.getParameter("value");
boolean isMerge = req.getParameter("isMerge") != null;
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/hudson/plugins/git/GitSCM.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@
import org.jenkinsci.Symbol;
import org.kohsuke.stapler.DataBoundConstructor;
import org.kohsuke.stapler.DataBoundSetter;
import org.kohsuke.stapler.StaplerRequest2;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.export.Exported;

import jakarta.servlet.ServletException;
import javax.servlet.ServletException;

import java.io.File;
import java.io.IOException;
Expand Down Expand Up @@ -1884,7 +1884,7 @@ public static PreBuildMergeOptions createMergeOptions(UserMergeOptions mergeOpti
return mergeOptions;
}

public FormValidation doGitRemoteNameCheck(StaplerRequest2 req)
public FormValidation doGitRemoteNameCheck(StaplerRequest req)
throws IOException, ServletException {
String mergeRemoteName = req.getParameter("value");
boolean isMerge = req.getParameter("isMerge") != null;
Expand All @@ -1905,7 +1905,7 @@ public FormValidation doGitRemoteNameCheck(StaplerRequest2 req)
}

@Override
public boolean configure(StaplerRequest2 req, JSONObject formData) throws FormException {
public boolean configure(StaplerRequest req, JSONObject formData) throws FormException {
req.bindJSON(this, formData);
save();
return true;
Expand Down
16 changes: 8 additions & 8 deletions src/main/java/hudson/plugins/git/GitStatus.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.regex.Pattern;
import jakarta.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequest;

import static jakarta.servlet.http.HttpServletResponse.SC_BAD_REQUEST;
import static jakarta.servlet.http.HttpServletResponse.SC_OK;
import static javax.servlet.http.HttpServletResponse.SC_BAD_REQUEST;
import static javax.servlet.http.HttpServletResponse.SC_OK;
import jenkins.model.Jenkins;
import jenkins.model.ParameterizedJobMixIn;
import jenkins.scm.api.SCMEvent;
Expand Down Expand Up @@ -180,7 +180,7 @@ public HttpResponse doNotifyCommit(HttpServletRequest request, @QueryParameter(r

return new HttpResponse() {
@Override
public void generateResponse(StaplerRequest2 req, StaplerResponse2 rsp, Object node) throws IOException {
public void generateResponse(StaplerRequest req, StaplerResponse rsp, Object node) throws IOException {
rsp.setStatus(SC_OK);
rsp.setContentType("text/plain");
for (int i = 0; i < contributors.size(); i++) {
Expand Down Expand Up @@ -232,7 +232,7 @@ public static class ResponseContributor {
* @param rsp the response.
* @since 1.4.1
*/
public void addHeaders(StaplerRequest2 req, StaplerResponse2 rsp) {
public void addHeaders(StaplerRequest req, StaplerResponse rsp) {
}

/**
Expand All @@ -243,7 +243,7 @@ public void addHeaders(StaplerRequest2 req, StaplerResponse2 rsp) {
* @param w the writer.
* @since 1.4.1
*/
public void writeBody(StaplerRequest2 req, StaplerResponse2 rsp, PrintWriter w) {
public void writeBody(StaplerRequest req, StaplerResponse rsp, PrintWriter w) {
writeBody(w);
}

Expand Down Expand Up @@ -543,7 +543,7 @@ public PollingScheduledResponseContributor(Item project) {
*/
@Override
@SuppressWarnings("deprecation")
public void addHeaders(StaplerRequest2 req, StaplerResponse2 rsp) {
public void addHeaders(StaplerRequest req, StaplerResponse rsp) {
// Calls a deprecated getAbsoluteUrl() method because this is a remote API case
// as described in the Javadoc of the deprecated getAbsoluteUrl() method.
rsp.addHeader("Triggered", project.getAbsoluteUrl());
Expand Down Expand Up @@ -578,7 +578,7 @@ public ScheduledResponseContributor(Item project) {
*/
@Override
@SuppressWarnings("deprecation")
public void addHeaders(StaplerRequest2 req, StaplerResponse2 rsp) {
public void addHeaders(StaplerRequest req, StaplerResponse rsp) {
// Calls a deprecated getAbsoluteUrl() method because this is a remote API case
// as described in the Javadoc of the deprecated getAbsoluteUrl() method.
rsp.addHeader("Triggered", project.getAbsoluteUrl());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
import hudson.Extension;
import hudson.security.csrf.CrumbExclusion;

import jakarta.servlet.FilterChain;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/hudson/plugins/git/GitTagAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
import jenkins.model.*;
import org.jenkinsci.plugins.gitclient.Git;
import org.jenkinsci.plugins.gitclient.GitClient;
import org.kohsuke.stapler.StaplerRequest2;
import org.kohsuke.stapler.StaplerResponse2;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerResponse;
import org.kohsuke.stapler.export.Exported;
import org.kohsuke.stapler.export.ExportedBean;
import org.kohsuke.stapler.interceptor.RequirePOST;

import jakarta.servlet.ServletException;
import javax.servlet.ServletException;
import java.io.File;
import java.io.IOException;
import java.util.*;
Expand Down Expand Up @@ -149,7 +149,7 @@ public String getTooltip() {
* @throws ServletException on servlet error
*/
@RequirePOST
public synchronized void doSubmit(StaplerRequest2 req, StaplerResponse2 rsp) throws IOException, ServletException {
public synchronized void doSubmit(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
getACL().checkPermission(getPermission());

try (MultipartFormDataParser parser = new MultipartFormDataParser(req)) {
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/hudson/plugins/git/browser/AssemblaWeb.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
import org.kohsuke.stapler.DataBoundConstructor;
import org.kohsuke.stapler.interceptor.RequirePOST;
import org.kohsuke.stapler.QueryParameter;
import org.kohsuke.stapler.StaplerRequest2;
import org.kohsuke.stapler.StaplerRequest;

import edu.umd.cs.findbugs.annotations.NonNull;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import jakarta.servlet.ServletException;
import javax.servlet.ServletException;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
Expand Down Expand Up @@ -98,7 +98,7 @@ public String getDisplayName() {
@Override
@SuppressFBWarnings(value = "NP_PARAMETER_MUST_BE_NONNULL_BUT_MARKED_AS_NULLABLE",
justification = "Inherited javadoc commits that req is non-null")
public AssemblaWeb newInstance(StaplerRequest2 req, @NonNull JSONObject jsonObject) throws FormException {
public AssemblaWeb newInstance(StaplerRequest req, @NonNull JSONObject jsonObject) throws FormException {
return req.bindJSON(AssemblaWeb.class, jsonObject);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import net.sf.json.JSONObject;
import org.jenkinsci.Symbol;
import org.kohsuke.stapler.DataBoundConstructor;
import org.kohsuke.stapler.StaplerRequest2;
import org.kohsuke.stapler.StaplerRequest;

import edu.umd.cs.findbugs.annotations.NonNull;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
Expand Down Expand Up @@ -81,7 +81,7 @@ public String getDisplayName() {
@Override
@SuppressFBWarnings(value = "NP_PARAMETER_MUST_BE_NONNULL_BUT_MARKED_AS_NULLABLE",
justification = "Inherited javadoc commits that req is non-null")
public BitbucketServer newInstance(StaplerRequest2 req, @NonNull JSONObject jsonObject) throws FormException {
public BitbucketServer newInstance(StaplerRequest req, @NonNull JSONObject jsonObject) throws FormException {
return req.bindJSON(BitbucketServer.class, jsonObject);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/hudson/plugins/git/browser/BitbucketWeb.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import net.sf.json.JSONObject;
import org.jenkinsci.Symbol;
import org.kohsuke.stapler.DataBoundConstructor;
import org.kohsuke.stapler.StaplerRequest2;
import org.kohsuke.stapler.StaplerRequest;

import edu.umd.cs.findbugs.annotations.NonNull;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
Expand Down Expand Up @@ -82,7 +82,7 @@ public String getDisplayName() {
@Override
@SuppressFBWarnings(value = "NP_PARAMETER_MUST_BE_NONNULL_BUT_MARKED_AS_NULLABLE",
justification = "Inherited javadoc commits that req is non-null")
public BitbucketWeb newInstance(StaplerRequest2 req, @NonNull JSONObject jsonObject) throws FormException {
public BitbucketWeb newInstance(StaplerRequest req, @NonNull JSONObject jsonObject) throws FormException {
return req.bindJSON(BitbucketWeb.class, jsonObject);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/hudson/plugins/git/browser/CGit.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import net.sf.json.JSONObject;
import org.jenkinsci.Symbol;
import org.kohsuke.stapler.DataBoundConstructor;
import org.kohsuke.stapler.StaplerRequest2;
import org.kohsuke.stapler.StaplerRequest;

import edu.umd.cs.findbugs.annotations.NonNull;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
Expand Down Expand Up @@ -92,7 +92,7 @@ public String getDisplayName() {
@Override
@SuppressFBWarnings(value = "NP_PARAMETER_MUST_BE_NONNULL_BUT_MARKED_AS_NULLABLE",
justification = "Inherited javadoc commits that req is non-null")
public CGit newInstance(StaplerRequest2 req, @NonNull JSONObject jsonObject) throws FormException {
public CGit newInstance(StaplerRequest req, @NonNull JSONObject jsonObject) throws FormException {
return req.bindJSON(CGit.class, jsonObject);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
import org.kohsuke.stapler.DataBoundConstructor;
import org.kohsuke.stapler.interceptor.RequirePOST;
import org.kohsuke.stapler.QueryParameter;
import org.kohsuke.stapler.StaplerRequest2;
import org.kohsuke.stapler.StaplerRequest;

import edu.umd.cs.findbugs.annotations.NonNull;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import jakarta.servlet.ServletException;
import javax.servlet.ServletException;
import java.io.IOException;
import java.net.URL;
import java.util.regex.Pattern;
Expand Down Expand Up @@ -79,7 +79,7 @@ public String getDisplayName() {
@Override
@SuppressFBWarnings(value = "NP_PARAMETER_MUST_BE_NONNULL_BUT_MARKED_AS_NULLABLE",
justification = "Inherited javadoc commits that req is non-null")
public FisheyeGitRepositoryBrowser newInstance(StaplerRequest2 req, @NonNull JSONObject jsonObject) throws FormException {
public FisheyeGitRepositoryBrowser newInstance(StaplerRequest req, @NonNull JSONObject jsonObject) throws FormException {
return req.bindJSON(FisheyeGitRepositoryBrowser.class, jsonObject);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
import org.kohsuke.stapler.DataBoundConstructor;
import org.kohsuke.stapler.interceptor.RequirePOST;
import org.kohsuke.stapler.QueryParameter;
import org.kohsuke.stapler.StaplerRequest2;
import org.kohsuke.stapler.StaplerRequest;

import edu.umd.cs.findbugs.annotations.NonNull;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import jakarta.servlet.ServletException;
import javax.servlet.ServletException;
import java.io.IOException;
import java.net.URISyntaxException;
import java.net.URL;
Expand Down Expand Up @@ -84,7 +84,7 @@ public String getDisplayName() {
@Override
@SuppressFBWarnings(value = "NP_PARAMETER_MUST_BE_NONNULL_BUT_MARKED_AS_NULLABLE",
justification = "Inherited javadoc commits that req is non-null")
public GitBlitRepositoryBrowser newInstance(StaplerRequest2 req, @NonNull JSONObject jsonObject) throws FormException {
public GitBlitRepositoryBrowser newInstance(StaplerRequest req, @NonNull JSONObject jsonObject) throws FormException {
return req.bindJSON(GitBlitRepositoryBrowser.class, jsonObject);
}

Expand Down
6 changes: 3 additions & 3 deletions src/main/java/hudson/plugins/git/browser/GitLab.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
import org.jenkinsci.Symbol;
import org.kohsuke.stapler.DataBoundConstructor;
import org.kohsuke.stapler.DataBoundSetter;
import org.kohsuke.stapler.StaplerRequest2;
import org.kohsuke.stapler.StaplerRequest;

import java.io.IOException;
import java.net.URL;

import edu.umd.cs.findbugs.annotations.NonNull;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import jakarta.servlet.ServletException;
import javax.servlet.ServletException;

import org.kohsuke.stapler.QueryParameter;

Expand Down Expand Up @@ -145,7 +145,7 @@ public String getDisplayName() {
@Override
@SuppressFBWarnings(value = "NP_PARAMETER_MUST_BE_NONNULL_BUT_MARKED_AS_NULLABLE",
justification = "Inherited javadoc commits that req is non-null")
public GitLab newInstance(StaplerRequest2 req, @NonNull JSONObject jsonObject) throws FormException {
public GitLab newInstance(StaplerRequest req, @NonNull JSONObject jsonObject) throws FormException {
return req.bindJSON(GitLab.class, jsonObject);
}

Expand Down
Loading