MavenActionUtil.getMavenProject(e.getDataContext()) is Null?
I want to develop a plugin just like "Maven Helper". I have to get the "MavenProject" object before I can do some biz logic. But I found the MavenProjectsManager is null (I use it in a maven project.)? Could someone give me some dev guide about this ? Thanks!
public void actionPerformed(AnActionEvent e) {
Project project = e.getData(PlatformDataKeys.PROJECT);
VirtualFile file = e.getData(PlatformDataKeys.VIRTUAL_FILE);
if (file == null || project == null) {
return;
}
String fileName = file.getName();
if (!fileName.endsWith(POM_XML)) {
return;
}
final MavenProjectsManager projectsManager = MavenProjectsManager.getInstance(project);
Please sign in to leave a comment.
Please double-check Maven plugin is enabled in your sandbox config, your plugin has <depends> tag on Maven plugin and Maven plugin JARs are correctly attached to your IntelliJ Platform SDK (NOT to your module). If it still fails, please post full stacktrace.
Thanks for your reply! I just solved this program.
But I encounter another program. I use
to get the dependency tree and then traverse it. I found that the traverse result is different from the "mvn:dependency:tree". How can I get the same result?
Update:
I've known that the traverse result is the same as "mvn:dependency:tree -Dverbose"