Hi,
I am trying to create a new BitBucket project using scriptrunner. There seem to be a lack of examples on this and I am very confused by the documentation.
The idea is to have something working on the Script console that then I can use as a built it script.
I have tried using ProjectCreateRequest.Builder but in all honesty I cannot make sense of how to create an instance in order to pass it as a parameter to a ProjectService "create" method, I am not able to pass the static type checking.
Does anyone have an example of give me some pointers on how this will work?
Thanks
Hi Alberto,
Please try the following script in the Script Console, which in this example creates a new project with the key "NEW" and name "New Project".
import com.atlassian.sal.api.component.ComponentLocator
import com.atlassian.bitbucket.project.ProjectService
import com.atlassian.bitbucket.project.ProjectCreateRequest
ProjectService projectService = ComponentLocator.getComponent(ProjectService)
projectService.create(new ProjectCreateRequest.Builder().key("NEW").name("New Project").build())
I hope this helps answer your question?
Robert Giddings
Yes, it does, thanks you
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.