2012-02-29 101 views
0

我想爲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

回答

0

嘗試下面的一個根據您的jira api版本:

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

ProjectManager pm = ComponentAccessor.getProjectManager(); 

欲瞭解更多詳細看JIRA api

0

添加依賴判斷你的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>