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

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.io.*;
import java.lang.*;
public class DueDateIndicator extends AbstractJiraContextProvider
{
private static final int MILLIS_IN_DAY = 24 * 60 * 60 * 1000;

@Override
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;
}

//@Override
//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
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Sunday in Agility

You asked for it, so we delivered: images on issues have arrived

A picture tells a thousand words. And agility boards have just released their latest feature: cover images on issues – so now your board can tell a story at first glance. Upload attachmen...

242 views 2 11
Read article

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