com.github.eirslett.maven.plugins.frontend.lib.InstallationException Java Examples

The following examples show how to use com.github.eirslett.maven.plugins.frontend.lib.InstallationException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: InstallNodeAndYarnMojo.java    From frontend-maven-plugin with Apache License 2.0 6 votes vote down vote up
@Override
public void execute(FrontendPluginFactory factory) throws InstallationException {
    ProxyConfig proxyConfig = MojoUtils.getProxyConfig(this.session, this.decrypter);
    Server server = MojoUtils.decryptServer(this.serverId, this.session, this.decrypter);
    if (null != server) {
        factory.getNodeInstaller(proxyConfig).setNodeDownloadRoot(this.nodeDownloadRoot)
            .setNodeVersion(this.nodeVersion).setPassword(server.getPassword())
            .setUserName(server.getUsername()).install();
        factory.getYarnInstaller(proxyConfig).setYarnDownloadRoot(this.yarnDownloadRoot)
            .setYarnVersion(this.yarnVersion).setUserName(server.getUsername())
            .setPassword(server.getPassword()).install();
    } else {
        factory.getNodeInstaller(proxyConfig).setNodeDownloadRoot(this.nodeDownloadRoot)
            .setNodeVersion(this.nodeVersion).install();
        factory.getYarnInstaller(proxyConfig).setYarnDownloadRoot(this.yarnDownloadRoot)
            .setYarnVersion(this.yarnVersion).install();
    }
}
 
Example #2
Source File: HeliumBundleFactory.java    From zeppelin with Apache License 2.0 5 votes vote down vote up
void installNodeAndNpm() throws TaskRunnerException {
  if (nodeAndNpmInstalled) {
    return;
  }
  try {
    NodeInstaller nodeInstaller = frontEndPluginFactory
            .getNodeInstaller(getProxyConfig(isSecure(defaultNodeInstallerUrl)));
    nodeInstaller.setNodeVersion(NODE_VERSION);
    nodeInstaller.setNodeDownloadRoot(defaultNodeInstallerUrl);
    nodeInstaller.install();

    NPMInstaller npmInstaller = frontEndPluginFactory
            .getNPMInstaller(getProxyConfig(isSecure(defaultNpmInstallerUrl)));
    npmInstaller.setNpmVersion(NPM_VERSION);
    npmInstaller.setNpmDownloadRoot(defaultNpmInstallerUrl + "/" + NPM_PACKAGE_NAME + "/-/");
    npmInstaller.install();

    YarnInstaller yarnInstaller = frontEndPluginFactory
            .getYarnInstaller(getProxyConfig(isSecure(defaultYarnInstallerUrl)));
    yarnInstaller.setYarnVersion(YARN_VERSION);
    yarnInstaller.setYarnDownloadRoot(defaultYarnInstallerUrl);
    yarnInstaller.install();
    yarnCacheDir.mkdirs();
    String yarnCacheDirPath = yarnCacheDir.getAbsolutePath();
    yarnCommand(frontEndPluginFactory, "config set cache-folder " + yarnCacheDirPath);

    configureLogger();
    nodeAndNpmInstalled = true;
  } catch (InstallationException e) {
    logger.error(e.getMessage(), e);
  }
}
 
Example #3
Source File: HeliumBundleFactoryTest.java    From zeppelin with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() throws InstallationException, TaskRunnerException, IOException {
  zeppelinHomePath = System.getProperty(ConfVars.ZEPPELIN_HOME.getVarName());
  System.setProperty(ConfVars.ZEPPELIN_HOME.getVarName(), "../");

  ZeppelinConfiguration conf = ZeppelinConfiguration.create();
  nodeInstallationDir =
      new File(conf.getRelativeDir(ConfVars.ZEPPELIN_DEP_LOCALREPO), HELIUM_LOCAL_REPO);
  hbf = new HeliumBundleFactory(conf);
  hbf.installNodeAndNpm();
  hbf.copyFrameworkModulesToInstallPath(true);
}
 
Example #4
Source File: InstallNodeAndNpmMojo.java    From frontend-maven-plugin with Apache License 2.0 5 votes vote down vote up
@Override
public void execute(FrontendPluginFactory factory) throws InstallationException {
    ProxyConfig proxyConfig = MojoUtils.getProxyConfig(session, decrypter);
    String nodeDownloadRoot = getNodeDownloadRoot();
    String npmDownloadRoot = getNpmDownloadRoot();
    Server server = MojoUtils.decryptServer(serverId, session, decrypter);
    if (null != server) {
        factory.getNodeInstaller(proxyConfig)
            .setNodeVersion(nodeVersion)
            .setNodeDownloadRoot(nodeDownloadRoot)
            .setNpmVersion(npmVersion)
            .setUserName(server.getUsername())
            .setPassword(server.getPassword())
            .install();
        factory.getNPMInstaller(proxyConfig)
            .setNodeVersion(nodeVersion)
            .setNpmVersion(npmVersion)
            .setNpmDownloadRoot(npmDownloadRoot)
            .setUserName(server.getUsername())
            .setPassword(server.getPassword())
            .install();
    } else {
        factory.getNodeInstaller(proxyConfig)
            .setNodeVersion(nodeVersion)
            .setNodeDownloadRoot(nodeDownloadRoot)
            .setNpmVersion(npmVersion)
            .install();
        factory.getNPMInstaller(proxyConfig)
            .setNodeVersion(this.nodeVersion)
            .setNpmVersion(this.npmVersion)
            .setNpmDownloadRoot(npmDownloadRoot)
            .install();
    }
}
 
Example #5
Source File: NodeManager.java    From wisdom with Apache License 2.0 5 votes vote down vote up
/**
 * Installs node in ~/.wisdom/node/$version.
 * The installation process is the following:
 * <ol>
 * <li>download node</li>
 * <li>expand node to the right location</li>
 * </ol>
 * <p/>
 *
 * @throws java.io.IOException
 */
public void installIfNotInstalled() throws IOException {
    try {
        factory.getNodeAndNPMInstaller(proxy())
                .install(mojo.getNodeVersion(),
                        mojo.getNPMVersion(),
                        mojo.getNodeDistributionRootUrl(),
                        mojo.getNpmRegistryRootUrl() + "/npm/-/");
        if (!getNodeExecutable().isFile()) {
            throw new IOException("Node installation failed - " + getNodeExecutable().getAbsolutePath() + " does not exist");
        }
    } catch (InstallationException e) {
        throw new IOException(e);
    }
}
 
Example #6
Source File: HeliumBundleFactoryTest.java    From zeppelin with Apache License 2.0 4 votes vote down vote up
@Test
public void testInstallNpm() throws InstallationException {
  assertTrue(new File(nodeInstallationDir, "/node/npm").isFile());
  assertTrue(new File(nodeInstallationDir, "/node/node").isFile());
  assertTrue(new File(nodeInstallationDir, "/node/yarn/dist/bin/yarn").isFile());
}