Hi,
I need to retrieve the sprint Name of a given Sprint ID (e.g. let's say we have SprintID = 101),
I have GreenHopper 6.1.5 on my Jira Instance 6.1.5, so, I put the following dependency in my pom.xml:
<dependency>
<groupId>com.atlassian.jira.plugins</groupId>
<artifactId>jira-greenhopper-plugin</artifactId>
<version>6.1.5</version>
<scope>provided</scope>
</dependency>
and inside my code, I injected SprintManager and I put:
log.debug("Sprint: " + sprintManager.getSprint(101).getValue().getName());
I obtained the following:
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'cust_single-stat-resource' defined in URL [bundle://282.0:0/META-INF/spring/atlassian-plugins-components.xml]: Unsatisfied dependency expressed through constructor argument with index 2 of type [com.atlassian.greenhopper.service.sprint.SprintManager]: : No unique bean of type [com.atlassian.greenhopper.service.sprint.SprintManager] is defined: Unsatisfied dependency of type [interface com.atlassian.greenhopper.service.sprint.SprintManager]: expected at least 1 matching bean; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [com.atlassian.greenhopper.service.sprint.SprintManager] is defined: Unsatisfied dependency of type [interface com.atlassian.greenhopper.service.sprint.SprintManager]: expected at least 1 matching bean
What I have missed?
Thanks,
Rosy
This is relatively straightforward in Script Runner 3, if you wanted to give that a try, eg:
import com.atlassian.greenhopper.service.sprint.SprintManager import com.onresolve.scriptrunner.runner.customisers.JiraAgileBean import com.onresolve.scriptrunner.runner.customisers.WithPlugin @WithPlugin("com.pyxis.greenhopper.jira") @JiraAgileBean SprintManager sprintManager sprintManager.getSprint(10).getValue().getName()
Hi @JamieA ,
Hope you are good,
My scenario is to update sprint goal, with the board owner name when a sprint is closed via script listener. I am trying it but i failed many times. can you help me on this.
Thankyou
Harish Kumar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Guys,
Maybe the answer posted here could help: https://answers.atlassian.com/questions/319207/does-anyone-know-how-to-implement-the-sprintmanager
Personally, I didn't try it as my specifications were modified and for the moment, I do not need to have all sprints , but we have the same request there, maybe, it could help.
Thanks,
Rosy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
CustomField sprint = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Sprint");
Issue issue = ComponentAccessor.getIssueManager().getIssueObject(issueId);
ArrayList<Sprint> list = (ArrayList<Sprint>) sprint.getValue(issue);
if(list != null) {
Iterator<Sprint> it = list.iterator();
while(it.hasNext()) {
Sprint current = it.next();
log.info("Sprint: {}", current.getName());
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello David,
How did you get the Sprint object traversing through an issue? Can you please post some code?
I already asked this question (https://answers.atlassian.com/questions/319525/how-to-get-sprint-names-of-a-defined-issue#) but I didn't get any answer yet.
Many thanks,
Rosy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am attempting a similar implementation, and I also am seeing a null pointer after the call to SprintManager sprintManager = ComponentAccessor.getComponent(SprintManagerImpl.class);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi David ,
I am also facing the same issue with null pointer when accessing sprintManager via ComponentAccessor.getComponent.
Is there a way to get it working ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Jamie.
but there's no way to code that in a normal plugin other than Script RunneR?
Thanks,
Rosy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am also seeing a null pointer after a call to SprintManager sprintManager = ComponentAccessor.getComponent(SprintManagerImpl.class);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am able to successfully get a Sprint Object, traversing through an issue, so I am confident my local configuration is proper (POM.XML, etc). I need to have the ability to query and present a list of all active Sprints as a stand-alone entity.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you Jobin. The plugin was installed successfully when I added:
<component key="sprintManager" name="Sprint Manager" class="com.atlassian.greenhopper.service.sprint.SprintManagerImpl">
<interface>com.atlassian.greenhopper.service.sprint.SprintManager</interface>
</component>
But, I returns the following exception:
java.lang.NullPointerException at com.atlassian.greenhopper.service.sprint.SprintManagerImpl.getSprint(SprintManagerImpl.java:68)
in this line of code where the SprintManager was injected:
log.debug("Sprint: " + sprintManager.getSprint(101).getValue().getName());
although the class SprintManagerImpl is the suitable Jira Agile API Class 6.1.5.
My main request is to retrieve the sprint name of a given ID (here 101 for example).
Is there a way to get that? Did I miss something here?
Many thanks,
Rosy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am guessing some of the internal classess are not loaded in this case. Haven't tried this API before and so I am not sure. Maybe some one else will chime in ;)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Try the component-import. See https://developer.atlassian.com/display/DOCS/UnsatisfiedDependencyException+-+Error+creating+bean+with+namefor details.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jobin,
When I added the following:
<component-import key="sprintManager" interface="com.atlassian.greenhopper.service.sprint.SprintManager"/>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Can you try the fix suggested here?
http://www.j-tricks.com/tutorials/component-import-gotchas-nosuchbeandefinitionexception
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Jobin but when I added the following:
<component key="sprintManager" name="Sprint Manager"/> as suggested by the article, I obtained an error telling me: required class. My version is 6.1.5
Can you please help?
Thanks,
Rosy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You wil need the class and the interface like this:
<component key="sprintManager" name="Sprint Manager" class=""> <interface>com.atlassian.greenhopper.service.sprint.SprintManager</interface> </component>
Find out the class from the JIRA Agile APIs.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.