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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,463,033
Community Members
 
Community Events
176
Community Groups

How to sync Components between Jira projects

Hello everyone

I would like the syncronize the composent who are in project n°1 and for example the project n°2 he can use the components who are in the project n°1. 

 

I'm find this script : ( https://mraddon.blog/2021/04/25/how-to-sync-components-between-jira-projects/ )

script_sync_components1.png

it's the second party

script_sync_components2.png

in this script i can enter the project key but he don't working 

You can help me ???

 

 

3 answers

1 vote

Ok, so this is not going to do what you think it is.  Rather than try to fix your scripts, I would like to check if you actually want to do this!

Components are project items, they do not go across projects.  The scripts you've got are broadly trying to duplicate, not share.

Components in different projects are different and independant things, no matter what their names are - Component "Cat" in project ABC is not the same component as "Dog" in project ABC or "Cat" in project DEF.

Are you sure you want duplicate component names?

No i would like than a project n°1 use the project n°2 and when i add the components in the project n°2 the components he should syncronise for show ad use in the project n°1

 

Thanks in advance

Hi

You have a idea ??

Um, as I said, you can't do that.

Issues in project n*1 can only show and use the components in project n*1, they can't use the components from project n*2.

Hi @Nic Brough -Adaptavist- 

 

i have this errro when i create a new component :

 

2022-02-09 16:25:44,064 ERROR [runner.AbstractScriptListener]: *************************************************************************************
2022-02-09 16:25:44,064 ERROR [runner.AbstractScriptListener]: Script function failed on event: com.atlassian.jira.event.bc.project.component.ProjectComponentCreatedEvent, file: null
java.lang.NullPointerException: Cannot invoke method getId() on null object
at Script29.run(Script29.groovy:24)

 

You can help me please ?

0 votes
M Amine Community Leader Feb 08, 2022

Your script contains a small error. In fact "dest_prj" must contain project KEYs and not project names. 

 

Project keys cannot have spaces in them. 

0 votes
M Amine Community Leader Feb 08, 2022

Hi Salim,
@Nic Brough -Adaptavist- is right. You cannot share components between projects. 

The script you gave "duplicates" components between the two projects. Perhaps if you explain what is the end-user requirement we can help you? 

Hi 

I have a error when i create the component 

Error : 

2022-02-09 16:25:44,064 ERROR [runner.AbstractScriptListener]: *************************************************************************************
2022-02-09 16:25:44,064 ERROR [runner.AbstractScriptListener]: Script function failed on event: com.atlassian.jira.event.bc.project.component.ProjectComponentCreatedEvent, file: null
java.lang.NullPointerException: Cannot invoke method getId() on null object
at Script29.run(Script29.groovy:24)

 

You can help me please ?

Hi @M Amine 

I have this script he dupplicate the components between project and i would like when i change the name for the component , the name in the other project but actually when i change the name he create a new component with name changed

script_sync.png

 

You can help me ?

Thanks in advance

This is not going to work like that.  It can't because you don't know what you need to look for.

Imagine you've got a list of components, and the same list in the second project:

  • Dog
  • Bunny
  • Cat

If someone changes "Bunny" to "Guinea Pig" in TH, then 

How are you catching the event that they do that?

If you read the components in TH now, there is no Bunny, so you don't know what the change is from.  It actually looks like a delete.

Your code is going to have to get the whole list of components from both projects, compare them and try to guess what has changed.  If the list in source is longer, you know to add the missing ones, if the list is shorter, you'll need to delete a component from the destination, and if the list is the same length, you'll need to compare every item until you find the changed one.

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events