Documentation for JIRA 4.2. Documentation for other versions of JIRA is available too.
JIRA comes with a means of importing issues from Bugzilla. Unfortunately there are some aspects of this importer that are hardcoded, and require editing of the code to change. For instance:
(related feature requests: JRA-3701, JRA-6403)
The Bugzilla importer assumes a fixed set of Bugzilla severities, resolutions, and JIRA statuses :
static { // bugzilla's priorities mapping to JIRA priorities priorityMap.put("blocker", "" + IssueFieldConstants.BLOCKER_PRIORITY_ID); priorityMap.put("critical", "" + IssueFieldConstants.CRITICAL_PRIORITY_ID); priorityMap.put("major", "" + IssueFieldConstants.MAJOR_PRIORITY_ID); priorityMap.put("normal", "" + IssueFieldConstants.MAJOR_PRIORITY_ID); priorityMap.put("enhancement", "" + IssueFieldConstants.MINOR_PRIORITY_ID); priorityMap.put("minor", "" + IssueFieldConstants.MINOR_PRIORITY_ID); priorityMap.put("trivial", "" + IssueFieldConstants.TRIVIAL_PRIORITY_ID); // bugzilla resolutions mapping to JIRA resolutions resolutionMap.put("", null); resolutionMap.put("FIXED", "" + IssueFieldConstants.FIXED_RESOLUTION_ID); resolutionMap.put("INVALID", "" + IssueFieldConstants.INCOMPLETE_RESOLUTION_ID); resolutionMap.put("WONTFIX", "" + IssueFieldConstants.WONTFIX_RESOLUTION_ID); resolutionMap.put("LATER", "" + IssueFieldConstants.WONTFIX_RESOLUTION_ID); resolutionMap.put("REMIND", "" + IssueFieldConstants.WONTFIX_RESOLUTION_ID); resolutionMap.put("DUPLICATE", "" + IssueFieldConstants.DUPLICATE_RESOLUTION_ID); resolutionMap.put("WORKSFORME", "" + IssueFieldConstants.CANNOTREPRODUCE_RESOLUTION_ID); resolutionMap.put("NEEDTESTCASE", "" + IssueFieldConstants.INCOMPLETE_RESOLUTION_ID); // bugzilla status mapping to JIRA status statusMap.put("UNCONFIRMED", "" + IssueFieldConstants.OPEN_STATUS_ID); statusMap.put("NEW", "" + IssueFieldConstants.OPEN_STATUS_ID); statusMap.put("ASSIGNED", "" + IssueFieldConstants.OPEN_STATUS_ID); statusMap.put("REOPENED", "" + IssueFieldConstants.REOPENED_STATUS_ID); statusMap.put("RESOLVED", "" + IssueFieldConstants.RESOLVED_STATUS_ID); statusMap.put("VERIFIED", "" + IssueFieldConstants.RESOLVED_STATUS_ID); statusMap.put("CLOSED", "" + IssueFieldConstants.CLOSED_STATUS_ID); // workflow Mappings wfStepMap.put("1", new Integer("1")); wfStepMap.put("2", new Integer("2")); wfStepMap.put("3", new Integer("3")); wfStepMap.put("4", new Integer("5")); wfStepMap.put("5", new Integer("4")); wfStepMap.put("6", new Integer("6")); wfStatusMap.put("1", "Open"); wfStatusMap.put("3", "In Progress"); wfStatusMap.put("4", "Reopened"); wfStatusMap.put("5", "Resolved"); wfStatusMap.put("6", "Closed"); }
(related feature request: JRA-3890)
By default, the Bugzilla importer creates usernames which are equal to the email addresses of reporters (which act as the Bugzilla logins). If instead you wish to infer a shorter username from the email (eg. 'joe' from 'joe@company.com'), you can do this by modifying this code:
/** * Given a Bugzilla 'profile' user record, infer a JIRA username from it. * In Bugzilla your username is your email address, and this will become your JIRA username, unless this method * is overridden to implement a different scheme. */ protected String getUsernameFromBugzillaProfile(ResultSet bugzillaProfileResultSet) throws SQLException { return TextUtils.noNull(bugzillaProfileResultSet.getString("login_name")).toLowerCase().trim(); // Alternatively, use the first part ('joe' in 'joe@company.com') // String name = bugzillaProfileResultSet.getString("login_name"); // name = TextUtils.noNull(name).trim(); // int i = name.indexOf("@"); // if (i != -1) name = name.substring(0, i); // return name; }
The Bugzilla importer code can be obtained from the JIRA documentation website (the Importing data from Bugzilla page), at the bottom. A direct link to the latest source is:
In JIRA Standalone:
external-source/src
external-source/src
Please note that you may need to restart JIRA Standalone in order for your changes to be detected.
例:
jturner@teacup:/tmp/atlassian-jira-enterprise-3.4.2-standalone$ mkdir external-source/src jturner@teacup:/tmp/atlassian-jira-enterprise-3.4.2-standalone$ cd external-source/src jturner@teacup:/tmp/atlassian-jira-enterprise-3.4.2-standalone/external-source/src$ wget -q 'http://www.atlassian.com/software/jira/docs/latest/importers/BugzillaImportBean.java' jturner@teacup:/tmp/atlassian-jira-enterprise-3.4.2-standalone/external-source/src$ ls BugzillaImportBean.java jturner@teacup:/tmp/atlassian-jira-enterprise-3.4.2-standalone/external-source/src$ cd .. jturner@teacup:/tmp/atlassian-jira-enterprise-3.4.2-standalone/external-source$ ant Buildfile: build.xml prepare: [mkdir] Created dir: /tmp/atlassian-jira-enterprise-3.4.2-standalone/external-source/etc [mkdir] Created dir: /tmp/atlassian-jira-enterprise-3.4.2-standalone/external-source/lib compile: [javac] Compiling 1 source file to /tmp/atlassian-jira-enterprise-3.4.2-standalone/atlassian-jira/WEB-INF/classes [javac] Note: /tmp/atlassian-jira-enterprise-3.4.2-standalone/external-source/src/BugzillaImportBean.java uses or overrides a deprecated API. [javac] Note: Recompile with -Xlint:deprecation for details. [javac] Note: /tmp/atlassian-jira-enterprise-3.4.2-standalone/external-source/src/BugzillaImportBean.java uses unchecked or unsafe operations. [javac] Note: Recompile with -Xlint:unchecked for details. BUILD SUCCESSFUL Total time: 3 seconds jturner@teacup:/tmp/atlassian-jira-enterprise-3.4.2-standalone/external-source$
In JIRA Webapp/WAR edition
If you have the webapp edition of JIRA, copy BugzillaImportBean.java
into src/, and then run build.sh
/build.bat
as normal:
jturner@teacup:/tmp/atlassian-jira-enterprise-3.4.2$ cd src jturner@teacup:/tmp/atlassian-jira-enterprise-3.4.2/src$ wget -q 'http://www.atlassian.com/software/jira/docs/latest/importers/BugzillaImportBean.java' jturner@teacup:/tmp/atlassian-jira-enterprise-3.4.2/src$ cd .. jturner@teacup:/tmp/atlassian-jira-enterprise-3.4.2$ ./build.sh Buildfile: build.xml init: compile: Created dir: /tmp/atlassian-jira-enterprise-3.4.2/tmp/build/war Created dir: /tmp/atlassian-jira-enterprise-3.4.2/dist-generic Created dir: /tmp/atlassian-jira-enterprise-3.4.2/dist-tomcat Copying 3492 files to /tmp/atlassian-jira-enterprise-3.4.2/tmp/build/war Copied 2 empty directories to /tmp/atlassian-jira-enterprise-3.4.2/tmp/build/war Copying 1 file to /tmp/atlassian-jira-enterprise-3.4.2/tmp/build/war Compiling 1 source file to /tmp/atlassian-jira-enterprise-3.4.2/tmp/build/war/WEB-INF/classes Note: /tmp/atlassian-jira-enterprise-3.4.2/src/BugzillaImportBean.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: /tmp/atlassian-jira-enterprise-3.4.2/src/BugzillaImportBean.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. war: Building jar: /tmp/atlassian-jira-enterprise-3.4.2/dist-generic/atlassian-jira-3.4.2.war Building jar: /tmp/atlassian-jira-enterprise-3.4.2/dist-tomcat/atlassian-jira-3.4.2.war Copying 1 file to /tmp/atlassian-jira-enterprise-3.4.2/dist-tomcat -------------------------------------------------- Deployable WARs generated: TOMCAT: /tmp/atlassian-jira-enterprise-3.4.2/dist-tomcat/atlassian-jira-3.4.2.war GENERIC: /tmp/atlassian-jira-enterprise-3.4.2/dist-generic/atlassian-jira-3.4.2.war See http://www.atlassian.com/software/jira/docs/latest/servers/ for install instructions -------------------------------------------------- BUILD SUCCESSFUL Total time: 25 seconds jturner@teacup:/tmp/atlassian-jira-enterprise-3.4.2$
Then deploy the webapp in your app server.