Java源码示例:com.github.eirslett.maven.plugins.frontend.lib.InstallationException

示例1
@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();
    }
}
 
示例2
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);
  }
}
 
示例3
@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);
}
 
示例4
@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();
    }
}
 
示例5
/**
 * 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);
    }
}
 
示例6
@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());
}