Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 19:30 UTC, the site will be undergoing scheduled maintenance for a few hours. During this time, the site might be unavailable for a short while. Thanks for your patience.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Script runner unable to resolve class for com.atlassian.bitbucket.scm

Pavan Kumar Nayakanti
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 16, 2023

Am trying to use below libraries to introduce a merge check

import com.atlassian.bitbucket.permission.Permission
import com.atlassian.bitbucket.permission.PermissionService
import com.atlassian.bitbucket.repository.RepositoryService
import com.atlassian.bitbucket.scm.pull.MergeRequest
import com.atlassian.bitbucket.scm.pull.MergeRequestCheck
import com.atlassian.bitbucket.scm.pull.MergeRequestCheckContext
import com.atlassian.bitbucket.scm.pull.MergeRequestCheckResult
import com.atlassian.bitbucket.user.SecurityService

But the script could not be compiled, due to inability of resolving below classes. What i might be missing here? Please advise.

org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
Script100.groovy: 5: unable to resolve class com.atlassian.bitbucket.scm.pull.MergeRequestCheck
 @ line 5, column 1.
   import com.atlassian.bitbucket.scm.pull.MergeRequestCheck
   ^

Script100.groovy: 6: unable to resolve class com.atlassian.bitbucket.scm.pull.MergeRequestCheckContext
 @ line 6, column 1.
   import com.atlassian.bitbucket.scm.pull.MergeRequestCheckContext
   ^

Script100.groovy: 7: unable to resolve class com.atlassian.bitbucket.scm.pull.MergeRequestCheckResult
 @ line 7, column 1.
   import com.atlassian.bitbucket.scm.pull.MergeRequestCheckResult
   ^

3 errors

.

 

2 answers

1 vote
Dmitry Trubin
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 23, 2023

https://docs.atlassian.com/bitbucket-server/javadoc/5.7.0/spi/reference/com/atlassian/bitbucket/scm/pull/MergeRequestCheck.html

 

This interface is deprecated.
in 5.0 for removal in 6.0.

You are likely using Bitbucket of version higher than 6.0.

----

Refer to the documentation for the respective classes to find a replacement.

0 votes

Hi @Pavan Kumar Nayakanti 

As @Dmitry Trubin already said, some of these classes are deprecated and you will not be able to use them with bitbucket 6 or higher. Currently, ScriprRunner for bitbucket supports Bitbucket server 7.5.0 or higher.

Scriptrunner's merge checks will give you access to a 'mergeRequest' object, which you can use to access any merge-request-related information you need to apply your merge check logic.
I can help you further, if you let me know what kind of merge check you want to do.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events