use of org.jetbrains.idea.maven.model.MavenProjectProblem in project intellij-community by JetBrains.
the class InvalidProjectImportingTest method assertProblems.
private static void assertProblems(MavenProject project, String... expectedProblems) {
List<String> actualProblems = new ArrayList<>();
for (MavenProjectProblem each : project.getProblems()) {
actualProblems.add(each.getDescription());
}
assertOrderedElementsAreEqual(actualProblems, expectedProblems);
}
use of org.jetbrains.idea.maven.model.MavenProjectProblem in project intellij-community by JetBrains.
the class MavenDomAnnotator method addProblems.
private static void addProblems(DomElement element, MavenDomProjectModel model, DomElementAnnotationHolder holder, MavenProjectProblem.ProblemType... types) {
MavenProject mavenProject = MavenDomUtil.findProject(model);
if (mavenProject != null) {
for (MavenProjectProblem each : mavenProject.getProblems()) {
MavenProjectProblem.ProblemType type = each.getType();
if (!Arrays.asList(types).contains(type))
continue;
VirtualFile problemFile = LocalFileSystem.getInstance().findFileByPath(each.getPath());
LocalQuickFix[] fixes = LocalQuickFix.EMPTY_ARRAY;
if (problemFile != null && !Comparing.equal(mavenProject.getFile(), problemFile)) {
fixes = new LocalQuickFix[] { new OpenProblemFileFix(problemFile) };
}
holder.createProblem(element, HighlightSeverity.ERROR, each.getDescription(), fixes);
}
}
}
use of org.jetbrains.idea.maven.model.MavenProjectProblem in project intellij-community by JetBrains.
the class MiscImportingTest method testClearUnresolvedPluginsAfterPluginResolution.
public void testClearUnresolvedPluginsAfterPluginResolution() throws Exception {
try {
File repo = new File(myDir, "repo");
setRepositoryPath(repo.getPath());
importProject("<groupId>test</groupId>" + "<artifactId>project</artifactId>" + "<version>1</version>" + "" + "<build>" + " <plugins>" + " <plugin>" + " <artifactId>maven-surefire-plugin</artifactId>" + " </plugin>" + " </plugins>" + "</build>");
List<MavenProjectProblem> problems = myProjectsTree.getRootProjects().get(0).getProblems();
assertTrue(problems.size() > 0);
for (MavenProjectProblem problem : problems) {
assertTrue(problem.getDescription(), problem.getDescription().contains("Unresolved plugin"));
}
resolvePlugins();
assertEquals(0, myProjectsTree.getRootProjects().get(0).getProblems().size());
} finally {
// do not lock files by maven process
MavenServerManager.getInstance().shutdown(true);
}
}
Aggregations