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!
Please sign in to leave a comment.
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.
Dear Jakub, Is “MavenProjectsManager” not initialized? And how do i initialize it.
It's not something that you initialize explicitly. Are you running your code against the Maven-based project?
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.
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.
I need help, please
Dear all, can you help me? please~
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
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
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.
Please link your full plugin's sources