0

I would like to create a service for JIRA. I'm using atlassian-plugin-sdk-3.8.

I write program in java for that service.. When i'm importing the atlassian api

import com.atlassian.jira.project.ProjectManager;
import com.atlassian.jira.ComponentManager;
ProjectManager pm = ComponentManager.getInstance().getProjectCategories();

After i write it, i use atlas-package command.

But here it shows BUILD-FAILURE

[INFO] Compilation failure

F:\services\module\src\main\java\com\first\module\MyPlugin.java:[9,25] cannot fi
nd symbol

could not parse error message:   symbol:   class ComponentManager
  location: package com.atlassian.jira
F:\services\module\src\main\java\com\first\module\MyPlugin.java:20: cannot find
symbol
ProjectManager pm = ComponentManager.getInstance().getProjectCategories();
                    ^

Whats the reason?

sorin
  • 161,544
  • 178
  • 535
  • 806
xavierkcb
  • 129
  • 1
  • 2
  • 8
  • Have a look into the official [documentation](http://confluence.atlassian.com/display/JIRA/Appendix+A+-+Extending+JIRA). – DerMike Mar 06 '12 at 11:10

2 Answers2

0

Try one of the following depending on your jira api version:

ProjectManager pm = ComponentManager.getInstance().getProjectManager();

ProjectManager pm = ComponentAccessor.getProjectManager();

For more details look at JIRA api

Jacob Schoen
  • 14,034
  • 15
  • 82
  • 102
mxp
  • 180
  • 6
0

Add dependecies to your pom.xml:

<dependencies>
    <dependency>
        <groupId>com.atlassian.jira</groupId>
        <artifactId>jira-api</artifactId>
        <version>${jira.version}</version>
        <scope>provided</scope>
    </dependency>

    <!-- Add dependency on jira-core if you want access to JIRA implementation classes as well as the sanctioned API. -->
    <!-- This is not normally recommended, but may be required eg when migrating a plugin originally developed against JIRA 4.x -->
    <dependency>
        <groupId>com.atlassian.jira</groupId>
        <artifactId>jira-core</artifactId>
        <version>${jira.version}</version>
        <scope>provided</scope>
    </dependency>
    ...
</dependencies>