Hello,
I need to use one common service class in several plugins. Within this service i need to get id of plugin, where this service is declared as component in atlassian-plugin.xml. So i have many plugins with this class declared as 'personal' service for each plugin. And i need to have cache in with service, located in different directories for each plugins where it declared.
Is it possible?
Community moderators have prevented the ability to post new answers.
I found solution by myself:
URL descriptor = getClass().getClassLoader().getResource("atlassian-plugin.xml"); if (descriptor == null) { throw new IOException("Can't find atlassian-plugin.xml"); } try (InputStream is = descriptor.openStream()) { XmlDescriptorParser parser = new XmlDescriptorParser(is, Collections.<Application>emptySet()); String pluginKey = parser.getKey(); String id = pluginKey.substring(pluginKey.lastIndexOf('.') + 1).replaceFirst("^stash-", ""); // Do something with id }
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.