It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

BitBucket scriptrunner create project



   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?



1 answer

1 accepted

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

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Bitbucket

Powering DevOps with Bitbucket Server & Data Center

Hi everyone, The Cloud team recently announced 12 new DevOps features that help developers ship better code, faster   ! While we’re all excited about the new improvements to Bitbucket ...

1,107 views 0 5
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you