MavenProjectsManager.getInstance(project),why result is null?please help me ~

public class FromAction extends AnAction {
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
        MavenProjectsManager.getInstance(project).isMavenizedProject();
   }
}

The above is my example code

"MavenProjectsManager.getInstance(project)" is null
What can I do to get it?

thanks!
12 comments
Comment actions Permalink

Probably because it's not initialized in the current project.

Sorry, but it's hard to guess - if you provide a minimal reproducible project, I'll be able to check it locally.

0
Comment actions Permalink

Dear Jakub, Is “MavenProjectsManager” not initialized? And how do i initialize it.

0
Comment actions Permalink

It's not something that you initialize explicitly. Are you running your code against the Maven-based project?

0
Comment actions Permalink

Yes, I'm developing a plugin that uses Maven to package automatically. My plugin needs to get whether the current project is a maven project, so that it can continue to do something else.

Sorry, my Englist is poor.

0
Comment actions Permalink

This is my MavenUtils partial code.

I always can't get it“ MavenProjectsManager.getInstance(project)", The result returned by this method, and result is null.

0
Comment actions Permalink

I need help, please

0
Comment actions Permalink

Dear all, can you help me? please~

0
Comment actions Permalink

I found the registerComponents method in the com.intellij.openapi.components.impl.ComponentManagerImpl class, can I call this method to register maven components.

please help me, thanks

0
Comment actions Permalink

Currently the "DefaultPicoContainer" class

This is the result of my debugger. There is "MavenProjectsManager" class in the "componentKeyToAdapterCache" collection, but the result of the "componentKeyToAdapterCache.get" method is null

0
Comment actions Permalink

As shown in the figure, I copied the value in the componentKeyToAdapterCache collection and can find "org.jetbrains.idea.maven.project.MavenProjectsManager", but the get method in the source code is always null.

0
Comment actions Permalink

Please link your full plugin's sources

0

Please sign in to leave a comment.