我想在intellij idea插件开发中获得maven的本地存储库。
@Override
public void actionPerformed(AnActionEvent e) {
logger.info("begin generator");
Project project = e.getProject();
/*in here ,I want to get maven's local repository*/
if(project ==null)
return;
PsiJavaFile file = UtpJunitGenUtil.getSelectedJavaFile(e.getDataContext());
答案 0 :(得分:1)
您需要在Maven插件上添加依赖项(有关添加插件依赖项的信息,请参阅here)并使用以下代码:
MavenProjectsManager m = MavenProjectsManager.getInstance(project);
File localRepository = m.getGeneralSettings().getEffectiveLocalRepository();