与redmine对接

redmine使用的版本为 2.3.0
1、打开rest web service

2、jar依赖

<dependency>
    <groupId>com.taskadapter</groupId>
    <artifactId>redmine-java-api</artifactId>
    <version>1.17</version>
</dependency>

3、代码

public class test {
    public static void main(String[] args) {
        // TODO Auto-generated method stub
        RedmineManager mgr = new RedmineManager("http://xxxxxx/redmine",
                "kongxianghao", "12345678");
        try {
            tryGetIssues(mgr);
        } catch (Exception e) {
            e.printStackTrace();
        }

    }

    private static void tryGetIssues(RedmineManager mgr) throws Exception {
        // List<Project> list = mgr.getProjects();
        Project project = mgr.getProjectByKey("143");
        // 項目跟者
        for (Tracker tk : project.getTrackers()) {
            System.out.println(tk.getId() + "-->" + tk.getName());
        }
        // 项目的问题
        List<Issue> issues = mgr.getIssues("143", null);

        for (Issue issue : issues) {
            System.out.println(issue.getId() + issue.toString());
        }
    }
}

 

posted on 2017-05-10 23:08  祥昊  阅读(925)  评论(0编辑  收藏  举报

导航