Why doesn't Eclipse resolve all import statements?

Deleted user September 10, 2012

I'm trying out the JIRA report plugin tutorial: https://developer.atlassian.com/display/JIRADEV/Plugin+Tutorial+-+Creating+a+JIRA+Report

Working on the code in Eclipse I get a lot of error messages about imports that cannot be resoved. It seems pretty random which of them are OK, and which one is not. Compiling and running the plugin works fine, but those messages are pretty annoying:

I'm usually not developing in Eclipse or Java so it might be some setting I'm missing. I'm pretty sure though that the setup is according to what is described at Atlassian's developer website.

@Atlassian: Could be a good idea to update this example since the OutlooDateManager is deprecated.

9 answers

1 accepted

1 vote
Answer accepted
Felipe Reis
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 13, 2012

As you have already noticed, the tutorial is outdated. It includes some deprecated classes, and it ALSO includes classes that are no longer loaded by the jira 5 dependencies.

For instance com.opensimphony.user.User was replaced for com.atlassian.crowd.embedded.api.User on JIRA 5, I'm pretty sure that is the case for the other classes to.

I'm glad I could help! :)

Deleted user September 13, 2012

Seems to be the case. I actually thought of this as a possibility, but the only thing I could think of to check was the Atlassian API documentation. The classes in question are still documented. The OutlookDateManager class is marked as deprecated, so I expected o find similar information about the ones that were not found.

Any idea on how to find out which classes to use?

Deleted user September 13, 2012

Actually, after fixing the User class it is only the I18nBean class which is not resolved.

Felipe Reis
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 14, 2012

You need to use I18nFactory, which can be injected into your Servlet:

private final I18nHelper.BeanFactory i18nFactory

public MyClassConstructor(I18nHelper.BeanFactory i18nFactory) {

	this. i18nFactory =  i18nFactory

}

then you can create a I18nHelper

I18nHelper i18n = i18n = i18nFactory.getInstance(req.getLocale());

0 votes
Deleted user September 13, 2012

@Felipe: Seems to be the case. Can you post your comment as an answer so I can accept it?

0 votes
Felipe Reis
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 12, 2012

Hmmm. I think I got it!

As you have already noticed, the tutorial is outdated. It includes some deprecated classes, and it ALSO includes classes that are no longer loaded by the jira 5 dependencies.

For instance com.opensimphony.user.User was replaced for com.atlassian.crowd.embedded.api.User on JIRA 5, I'm pretty sure that is the case for the other classes to.

0 votes
Deleted user September 12, 2012

Fixed a few other issues:

  • Upgraded JDK 1.6 to release 32 (from 26), just in case.
  • Installed Eclipse Java EE IDE; was running anoter variant.
  • Installed Sonatype Maven. Could not do this previously without removing all of the Java IDE from Eclipse.
  • Found out the M2_REPO system variable was not set; created it.
  • Found a MAVEN_HOME variable from a legacy JIRA plugin project. Removed it.
  • Cleaning and rebuilding at every step.

Changes from before: None! :(

0 votes
Deleted user September 11, 2012

Nope, the problem persists :(

0 votes
Felipe Reis
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 11, 2012

Was the problem solved after changing the maven installation to plugin-sdk?

0 votes
Deleted user September 11, 2012

Correction: The plugin does not work. What I did was to run atlas-run, which started the JIRA instance. In the JIRA instance I located the plugin from the admin view. Only when I created a project did i found out that the plugin caused a blank project summary screen. The log reports about compilation problems.

0 votes
Felipe Reis
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 10, 2012

Which Maven repository are you using Eclipse's or Jira's?

I had the same problem as you because I was using the default maven installantion from Eclipse.

Try changing it in preferences->maven->installations

Deleted user September 11, 2012

I was using the Embedded Maven, thought I changed it ... Anyway, adding the Atlassian SDK Maven did the solve thi issue.

It says in the Installations dialog: Note: Embedded runtime is always used for dependency resolution, but does not use global settings when it is used to launch Maven. Does this mean there is no way around?

0 votes
Jobin Kuruvilla [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 10, 2012

If compiling and running works fine, then your Eclipse project classpath is outdated. Try recreating the eclipse project by:

mvn eclipse:clean eclipse:eclipse

and refresh the project in Eclipse. JIRA version is important for some classes but since you can compile fine using maven, it should be fine.

Deleted user September 10, 2012

You mean atlas-mvn, right?

Thanks for the tip, but the problem persists :(

MatthewC
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 10, 2012

& you did restart eclipse? Did a refresh of the workspace?

Deleted user September 10, 2012

Both! Made no difference.

Jobin Kuruvilla [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 10, 2012

clean the project :)

Deleted user September 10, 2012

Didn't help to clean either.

Felipe Reis
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 11, 2012

did you execute altas-mvn eclipse:eclipse and refreshed the project from Eclipse after changing the maven installation? What was the output?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events