Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot create facade "right" after project is imported #1819

Open
thahnen opened this issue Aug 30, 2024 · 0 comments
Open

Cannot create facade "right" after project is imported #1819

thahnen opened this issue Aug 30, 2024 · 0 comments

Comments

@thahnen
Copy link

thahnen commented Aug 30, 2024

Hello everyone,

I encountered the problem that, more or less, right after importing a project, running the following will return null. But when having a project already imported in the workspace and (re-)starting it, then it works:

public IMavenProjectFacade getProjectFacade(IProject project) {
  var projectManager = MavenPlugin.getMavenProjectRegistry();
  return projectManager.create(project, null);
}

I'm not sure why this is the case but this happens no matter how long I wait after opening a workspace before importing a Maven project. There is also no log or any other information on why the facade could not be created. My first guess here is that this shouldn't be the case as the ProjectRegistryManager#create(IProject) states in its comment that it will return a cached or create a new MavenProjectFacade but there is no null mentioned as a possible return value.

Does anyone have a clue if this is intended or not and if it is, what is a better approach to do it?

Giving you a bit of context on why we access it: When a project is opened we list all the files in it to forward it to our plug-in. Using m2e, we can exclude the output directory and the sub-modules as these are irrelevant files to us (in the case of the output directory) or just not this project files (for sub-modules).

Best,
Tobias

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant