Skip to content

Commit 3bf7402

Browse files
authored
[JENKINS-74848] Issue in config.xml CannotResolveClassException: com.cloudbees.jenkins.plugins.bitbucket.MergeWithGitSCMExtension (#911)
Add an alias to fix XStream serialisation
1 parent 0bf5661 commit 3bf7402

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/main/java/com/cloudbees/jenkins/plugins/bitbucket/BitbucketSCMSource.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,12 @@
5858
import hudson.RestrictedSince;
5959
import hudson.Util;
6060
import hudson.console.HyperlinkNote;
61+
import hudson.init.InitMilestone;
62+
import hudson.init.Initializer;
6163
import hudson.model.Action;
6264
import hudson.model.Actionable;
6365
import hudson.model.Item;
66+
import hudson.model.Items;
6467
import hudson.model.TaskListener;
6568
import hudson.plugins.git.GitSCM;
6669
import hudson.scm.SCM;
@@ -87,6 +90,7 @@
8790
import java.util.logging.Logger;
8891
import jenkins.authentication.tokens.api.AuthenticationTokens;
8992
import jenkins.model.Jenkins;
93+
import jenkins.plugins.git.MergeWithGitSCMExtension;
9094
import jenkins.plugins.git.traits.GitBrowserSCMSourceTrait;
9195
import jenkins.scm.api.SCMHead;
9296
import jenkins.scm.api.SCMHeadCategory;
@@ -140,6 +144,14 @@ public class BitbucketSCMSource extends SCMSource {
140144
private static final String CLOUD_REPO_TEMPLATE = "{/owner,repo}";
141145
private static final String SERVER_REPO_TEMPLATE = "/projects{/owner}/repos{/repo}";
142146

147+
/**
148+
* Mapping classes after refactoring for backward compatibility.
149+
*/
150+
@Initializer(before = InitMilestone.PLUGINS_STARTED)
151+
public static void aliases() {
152+
Items.XSTREAM2.addCompatibilityAlias("com.cloudbees.jenkins.plugins.bitbucket.MergeWithGitSCMExtension", MergeWithGitSCMExtension.class);
153+
}
154+
143155
/** How long to delay events received from Bitbucket in order to allow the API caches to sync. */
144156
private static /*mostly final*/ int eventDelaySeconds =
145157
Math.min(

0 commit comments

Comments
 (0)