Re-index project using Class ProjectReindexServiceImpl

Hi Guys,

In order to re-index some projects by the API,
I would like to know if there is an option to get instance of ProjectReindexServiceImpl without using the constructor.
Using the constructor requires many objects and I don’t want to create all of them.

Documentation of Class ProjectReindexServiceImpl:
https://docs.atlassian.com/software/jira/docs/api/8.5.0/com/atlassian/jira/bc/project/index/ProjectReindexServiceImpl.html

Thanks.

Hi,

try this simple code

import com.atlassian.jira.component.ComponentAccessor;

ProjectReindexService projectReindexService = ComponentAccessor.getComponent(ProjectReindexService.class);

if(projectReindexService.isReindexPossible(PROJECT)){
    projectReindex = projectReindexService.reindex(PROJECT);
}

Cheers
Adam Labus

Thanks for the simple solution.
Works good.