Getting package import error while creating due-date-indicator plugin?

parvati r I'm New Here Oct 23, 2017

Hi Guys,

I am attempting to build a due-date-indicator plugin. I have imported my code into the eclipse. I am getting errors in the package import statement in the .java file. In the .java file I am getting error in the "package com.atlassian.jira.user;" statement. In the eclipse it is showing error hint as "The declared package "com.atlassian.jira.user" does not match the expected package "com.example.plugins.tutorial". By keeping this error in the file I run my code using atlas command. I got the error in the Jira view issue page "Error rendering 'com.example.plugins.tutorial.duedate:due-date-indicator'. Please contact your JIRA administrators". How to resolve this error?

My .java file:

package com.example.plugins.tutorial;
package com.atlassian.jira.user;
import com.atlassian.jira.user.ApplicationUser;

import com.atlassian.jira.issue.Issue;
import com.atlassian.jira.plugin.webfragment.contextproviders.AbstractJiraContextProvider;
import com.atlassian.jira.plugin.webfragment.model.JiraHelper;

import java.sql.Timestamp;
import java.util.HashMap;
import java.util.Map;
import java.lang.*;
public class DueDateIndicator extends AbstractJiraContextProvider
private static final int MILLIS_IN_DAY = 24 * 60 * 60 * 1000;

public Map getContextMap(ApplicationUser applicationUser, JiraHelper jiraHelper) {
Map contextMap = new HashMap();
Issue currentIssue = (Issue) jiraHelper.getContextParams().get("issue");
Timestamp dueDate = currentIssue.getDueDate();
if (dueDate != null)
int currentTimeInDays = (int) (System.currentTimeMillis() / MILLIS_IN_DAY);
int dueDateTimeInDays = (int) (dueDate.getTime() / MILLIS_IN_DAY);

int daysAwayFromDueDateCalc = dueDateTimeInDays - currentTimeInDays + 1;
contextMap.put("daysAwayFromDueDate", daysAwayFromDueDateCalc);
return contextMap;

//public Map getContextMap(ApplicationUser arg0, JiraHelper arg1) {
//TODO Auto-generated method stub
// return null;


Thanks in advance

0 answers

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Julia Dillon
Posted Tuesday in Jira

Tell us how your team runs on Jira!

Hey Atlassian Community! Today we are launching a bunch of customer stories about the amazing work teams, like Dropbox and Twilio, are doing with Jira. You can check out the stories here. The thi...

181 views 1 17
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you