无法为JIRA创建服务

问题描述:

我想为JIRA创建服务。我使用的是atlassian-plugin-sdk-3.8。无法为JIRA创建服务

我写的程序在Java该服务..当我导入Atlassian的API

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

后,我写出来,我使用的是Atlas-package命令。

但在这里它显示BUILD-故障

 
[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(); 
        ^

请告诉我原因吗?

+0

看一看成官方[文档](http://confluence.atlassian.com/display/JIRA/Appendix+A+-+Extending+JIRA)。 – DerMike 2012-03-06 11:10:33

尝试下面的一个根据您的jira api版本:

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

ProjectManager pm = ComponentAccessor.getProjectManager(); 

欲了解更多详细看JIRA api

添加依赖判断你的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>