use of java.rmi.RemoteException in project che by eclipse.
the class ProjectResolverTest method setUp.
@BeforeMethod
public void setUp() throws Exception {
MavenServerContext.setLoggerAndListener(new MavenServerLogger() {
@Override
public void warning(Throwable t) throws RemoteException {
}
@Override
public void info(Throwable t) throws RemoteException {
}
@Override
public void error(Throwable t) throws RemoteException {
}
}, (file, relativePath) -> {
System.out.println(file.getAbsolutePath());
});
MavenSettings mavenSettings = new MavenSettings();
mavenSettings.setLoggingLevel(MavenTerminal.LEVEL_INFO);
mavenSettings.setMavenHome(new File(System.getenv("M2_HOME")));
mavenSettings.setGlobalSettings(new File(System.getProperty("user.home"), ".m2/settings.xml"));
File localRepository = new File("target/localrepo");
localRepository.mkdirs();
mavenSettings.setLocalRepository(localRepository);
mavenServer = new MavenServerImpl(mavenSettings);
mavenServer.setComponents(null, true, (level, message, throwable) -> {
System.out.println(message);
}, new MavenServerProgressNotifier() {
@Override
public void setText(String text) throws RemoteException {
System.out.println(text);
}
@Override
public void setPercent(double percent) throws RemoteException {
}
@Override
public void setPercentUndefined(boolean undefined) throws RemoteException {
}
@Override
public boolean isCanceled() throws RemoteException {
return false;
}
}, true);
}
use of java.rmi.RemoteException in project che by eclipse.
the class MavenServerTest method testCustomComponents.
@Test
public void testCustomComponents() throws Exception {
MavenSettings mavenSettings = new MavenSettings();
mavenSettings.setLoggingLevel(MavenTerminal.LEVEL_DEBUG);
MavenServerImpl mavenServerImpl = new MavenServerImpl(mavenSettings);
boolean[] isPrintCalled = new boolean[] { false };
mavenServerImpl.setComponents(null, false, new MavenTerminal() {
@Override
public void print(int level, String message, Throwable throwable) throws RemoteException {
isPrintCalled[0] = true;
}
}, null, false);
mavenServerImpl.getEffectivePom(new File(MavenServerTest.class.getResource("/EffectivePom/pom.xml").getFile()), Collections.emptyList(), Collections.emptyList());
Assert.assertTrue(isPrintCalled[0]);
}
use of java.rmi.RemoteException in project che by eclipse.
the class MavenServerWrapper method dispose.
public void dispose() {
MavenServer wrapped = getWrapped();
if (wrapped != null) {
try {
wrapped.dispose();
} catch (RemoteException e) {
LOG.debug(e.getMessage(), e);
onError();
}
}
uncustomize();
}
use of java.rmi.RemoteException in project che by eclipse.
the class MavenServerWrapper method reset.
public void reset() {
MavenServer wrapped = getWrapped();
if (wrapped != null) {
try {
wrapped.reset();
} catch (RemoteException e) {
LOG.debug(e.getMessage(), e);
onError();
}
}
uncustomize();
}
use of java.rmi.RemoteException in project che by eclipse.
the class MavenServerWrapper method customize.
public void customize(MavenWorkspaceCache cache, MavenTerminal mavenTerminal, MavenProgressNotifier notifier, boolean failOnUnresolvedDependency, boolean alwaysUpdateSnapshot) {
if (customization != null) {
uncustomize();
}
MavenTerminal mavenTerminalWrapper;
try {
mavenTerminalWrapper = new MavenTerminalWrapper(mavenTerminal);
UnicastRemoteObject.exportObject(mavenTerminalWrapper, 0);
} catch (RemoteException e) {
throw new RuntimeException(e);
}
MavenServerProgressNotifier wrapper;
try {
wrapper = new MavenServerProgressNotifierWrapper(notifier);
UnicastRemoteObject.exportObject(wrapper, 0);
} catch (RemoteException e) {
throw new RuntimeException(e);
}
customization = new MavenCustomization(cache, mavenTerminalWrapper, wrapper, failOnUnresolvedDependency, alwaysUpdateSnapshot);
perform(this::customizeMaven);
}
Aggregations