use of org.eclipse.che.plugin.maven.server.core.project.MavenProjectModifications in project che by eclipse.
the class MavenProjectManager method resolveMavenProject.
public void resolveMavenProject(IProject project, MavenProject mavenProject) {
MavenServerWrapper mavenServer = wrapperManager.getMavenServer(MavenWrapperManager.ServerType.RESOLVE);
try {
mavenNotifier.setText("Resolving project: " + mavenProject.getName());
mavenServer.customize(copyWorkspaceCache(), terminal, mavenNotifier, false, true);
MavenProjectModifications modifications = mavenProject.resolve(project, mavenServer, serverManager);
dispatcher.projectResolved(mavenProject, modifications);
} finally {
wrapperManager.release(mavenServer);
}
}
use of org.eclipse.che.plugin.maven.server.core.project.MavenProjectModifications in project che by eclipse.
the class MavenProjectManager method internalUpdate.
private void internalUpdate(MavenProject mavenProject, MavenProject parentProject, boolean isNew, boolean recursive, UpdateState state, Deque<MavenProject> stack) {
if (stack.contains(mavenProject)) {
//recursion
return;
}
stack.addFirst(mavenProject);
mavenNotifier.setText("Reading pom: " + mavenProject.getPomPath());
List<MavenProject> oldModules = findModules(mavenProject);
Set<MavenProject> oldChilds = new HashSet<>();
if (!isNew) {
oldChilds.addAll(findChildProjects(mavenProject));
}
writeLock.lock();
try {
if (!isNew) {
clearMavenKeyMap(mavenProject);
}
} finally {
writeLock.unlock();
}
MavenProjectModifications modifications = new MavenProjectModifications();
//re read maven project meta info from pom.xml
modifications = modifications.addChanges(mavenProject.read(serverManager));
writeLock.lock();
try {
fillMavenKeyMap(mavenProject);
projectToMavenProjectMap.put(mavenProject.getProject(), mavenProject);
} finally {
writeLock.unlock();
}
if (isNew) {
addToChild(parentProject, mavenProject);
} else {
updateChild(parentProject, mavenProject);
}
// if (hasparent) {
state.addUpdate(mavenProject, modifications);
// }
List<IProject> modules = mavenProject.getModulesProjects();
List<MavenProject> removedModules = oldModules.stream().filter(oldModule -> !modules.contains(oldModule.getProject())).collect(Collectors.toList());
for (MavenProject removedModule : removedModules) {
removeModule(mavenProject, removedModule);
internalDelete(mavenProject, removedModule, state);
oldChilds.removeAll(state.removedProjects);
}
for (IProject module : modules) {
MavenProject project = findMavenProject(module);
boolean isNewProject = project == null;
if (isNewProject) {
project = new MavenProject(module, workspaceProvider.get());
} else {
MavenProject parent = findParentProject(project);
if (parent != null && parent != mavenProject) {
//TODO add log
continue;
}
}
if (isNewProject || recursive) {
internalUpdate(project, mavenProject, isNewProject, recursive, state, stack);
} else {
if (updateChild(mavenProject, project)) {
state.addUpdate(project, new MavenProjectModifications());
}
}
}
oldChilds.addAll(findChildProjects(mavenProject));
for (MavenProject oldModule : oldChilds) {
internalUpdate(oldModule, findParentProject(oldModule), false, false, state, stack);
}
stack.pop();
}
Aggregations