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

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

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
Posted in Bitbucket

Share your software development horror stories!

Hey Community! I work on the Bitbucket product marketing team. With Halloween approaching, we wanted to discuss a topic tailor-made for October: development horror stories. Whether it was a lurk...

1,551 views 11 3
Join discussion

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