use of org.eclipse.che.plugin.maven.server.MavenServerWrapper 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.MavenServerWrapper in project che by eclipse.
the class MavenServerManagerTest method testLaunchMavenServer.
@Test
public void testLaunchMavenServer() throws Exception {
MavenServerWrapper server = manager.createMavenServer();
assertThat(server).isNotNull();
}
use of org.eclipse.che.plugin.maven.server.MavenServerWrapper in project che by eclipse.
the class MavenServerService method getEffectivePom.
/**
* Returns maven effective pom file.
*
* @param projectPath
* path to the opened pom file
* @return content of the effective pom
* @throws ServerException
* when getting mount point has a problem
* @throws NotFoundException
* when current pom file isn't exist
* @throws ForbiddenException
* when response code is 403
*/
@GET
@Path("effective/pom")
@Produces(TEXT_XML)
public String getEffectivePom(@QueryParam("projectpath") String projectPath) throws ServerException, NotFoundException, ForbiddenException {
RegisteredProject project = projectRegistry.getProject(projectPath);
if (project == null) {
throw new NotFoundException("Project " + projectPath + " doesn't exist");
}
MavenServerWrapper mavenServer = wrapperManager.getMavenServer(MavenWrapperManager.ServerType.DOWNLOAD);
try {
mavenServer.customize(projectManager.copyWorkspaceCache(), terminal, notifier, false, false);
VirtualFileEntry pomFile = project.getBaseFolder().getChild("pom.xml");
if (pomFile == null) {
throw new NotFoundException("pom.xml doesn't exist");
}
return mavenServer.getEffectivePom(pomFile.getVirtualFile().toIoFile(), Collections.emptyList(), Collections.emptyList());
} finally {
wrapperManager.release(mavenServer);
}
}
use of org.eclipse.che.plugin.maven.server.MavenServerWrapper in project che by eclipse.
the class ClasspathManager method downloadSources.
private boolean downloadSources(IPackageFragmentRoot fragmentRoot) throws JavaModelException {
fragmentRoot.getAdapter(MavenArtifactKey.class);
IClasspathEntry classpathEntry = fragmentRoot.getResolvedClasspathEntry();
MavenArtifactKey artifactKey = getArtifactKey(classpathEntry);
if (artifactKey != null) {
MavenServerWrapper mavenServer = wrapperManager.getMavenServer(MavenWrapperManager.ServerType.DOWNLOAD);
try {
mavenServer.customize(projectManager.copyWorkspaceCache(), terminal, notifier, false, false);
MavenArtifactKey sourceKey = new MavenArtifactKey(artifactKey.getGroupId(), artifactKey.getArtifactId(), artifactKey.getVersion(), artifactKey.getPackaging(), SOURCES);
MavenArtifact mavenArtifact = mavenServer.resolveArtifact(sourceKey, Collections.emptyList());
if (mavenArtifact.isResolved()) {
updateClasspath(projectManager.findMavenProject(fragmentRoot.getJavaProject().getProject()));
}
return mavenArtifact.isResolved();
} finally {
wrapperManager.release(mavenServer);
}
}
return false;
}
use of org.eclipse.che.plugin.maven.server.MavenServerWrapper in project che by eclipse.
the class MavenServerManagerTest method testEffectivePom.
@Test
public void testEffectivePom() throws Exception {
MavenServerWrapper mavenServer = manager.createMavenServer();
String effectivePom = mavenServer.getEffectivePom(new File(MavenServerManagerTest.class.getResource("/EffectivePom/pom.xml").getFile()), Collections.emptyList(), Collections.emptyList());
assertThat(effectivePom).isNotNull().isNotEmpty().contains("<!-- Effective POM for project").contains("'org.eclipse.che.parent:maven-parent-pom:pom:4.0.0-M6-SNAPSHOT'");
}
Aggregations