MavenProject (@NotNull String projectName) { List<MavenProject> projects = MavenProjectsManager.getInstance(myEnvironment.getProject()).getProjects(); MavenProject candidate = null; for (MavenProject mavenProject : projects) { if (projectName.equals(mavenProject.getName())) { if (candidate == null) { candidate = mavenProject; } else { return null; } } } if (candidate != null) { return candidate; } for (MavenProject mavenProject : projects) { String id = mavenProject.getMavenId().getGroupId() + ':' + mavenProject.getMavenId().getArtifactId() + ':' + mavenProject.getPackaging(); if (projectName.contains(id)) { if (candidate == null) { candidate = mavenProject; } else { return null; } } } if (candidate != null) { return candidate; } for (MavenProject mavenProject : projects) { if (projectName.equals(mavenProject.getMavenId().getArtifactId())) { if (candidate == null) { candidate = mavenProject; } else { return null; } } } return candidate; }