You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.
View groupJoin the community to find out what other Atlassian users are discussing, debating and creating.
Hi atlassian,
I have jira versions 7.x and 8.x and I want to build jira plugin to get two jar files. For jira version 7.x getEntityProperty() method returned:
com.atlassian.fugue.Option<EntityProperty> class type,
for jira version 8.x:
io.atlassian.fugue.Option<EntityProperty> class type,
I check the versions with statement, here my code:
if (version.equals("7")) {
com.atlassian.fugue.Option<EntityProperty> jsonValues =
propertyValues.getEntityProperty();
entity = jsonValues.getOrNull();
} else {
io.atlassian.fugue.Option<EntityProperty> jsonValues =
propertyValues.getEntityProperty();
entity = jsonValues.getOrNull();
}
When the jira version is 7.x in my pom.xml I get the following error:
package io.atlassian.fugue does not exist
and the case when version is 8.x:
incompatible types: io.atlassian.fugue.Option<com.atlassian.jira.entity.property.EntityProperty> cannot be converted to com.atlassian.fugue.Option<com.atlassian.jira.entity.property.EntityProperty>
How can I solve this problem for in order to my plugin work for both jira versions?
Thanks in advance,
Hello @Mamikon Papikyan ,
This question has been already answered in the below threads, in the developers community and in here:
Specifically:
@verenok you mean to build an app that’s compatible with both Jira 7 and Jira 8? There are two approaches:
- build compatibility (adapter) libraries for Jira 7 and Jira 8 (compiling each against the appropriate Jira version) and call the right library based on the Jira version
- use Java introspection to call the methods; since the only difference is in the return type it’s actually easy.
And:
This is what we use to access the property value from the return value of issuePropertyService.getProperty:
public static <T> T getEntityPropertyOrNull(PropertyResult propertyResult) { try { Object option = propertyResult.getClass().getMethod("getEntityProperty").invoke(propertyResult); return option.getClass().getMethod("getOrNull").invoke(option); } catch (InvocationTargetException | NoSuchMethodException | IllegalAccessException var2) { throw new IllegalStateException(var2); } }
Finally, please notice that this might not be the best place to get help on development related questions. In case further help will be needed on this topic, you might want to refer to the resources listed in https://developer.atlassian.com/resources:
Cheers,
Dario
Catch up with Atlassian Product Managers in our 2020 Demo Den round-up! From Advanced Roadmaps to Code in Jira to Next-Gen Workflows, check out the videos below to help up-level your work in the new ...
Connect with like-minded Atlassian users at free events near you!
Find an eventConnect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.
Host an eventYou're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.