Example usage for org.apache.commons.lang3 SystemUtils JAVA_RUNTIME_NAME

List of usage examples for org.apache.commons.lang3 SystemUtils JAVA_RUNTIME_NAME

Introduction

In this page you can find the example usage for org.apache.commons.lang3 SystemUtils JAVA_RUNTIME_NAME.

Prototype

String JAVA_RUNTIME_NAME

To view the source code for org.apache.commons.lang3 SystemUtils JAVA_RUNTIME_NAME.

Click Source Link

Document

The java.runtime.name System Property.

Usage

From source file:eu.over9000.skadi.Main.java

private static void printStartupInfo(final String[] args) {
    LOGGER.info("################################################################################");
    LOGGER.info("TIME:    " + LocalDateTime.now().toString());
    LOGGER.info("OS:      " + SystemUtils.OS_NAME + " " + SystemUtils.OS_VERSION + " " + SystemUtils.OS_ARCH);
    LOGGER.info("JAVA:    " + SystemUtils.JAVA_VERSION);
    LOGGER.info(/*ww w  .  j av  a  2  s .c o  m*/
            "         " + SystemUtils.JAVA_RUNTIME_NAME + " <build " + SystemUtils.JAVA_RUNTIME_VERSION + ">");
    LOGGER.info("VM:      " + SystemUtils.JAVA_VM_NAME + " <build" + SystemUtils.JAVA_VM_VERSION + ", "
            + SystemUtils.JAVA_VM_INFO + ">");
    LOGGER.info("VM-ARGS: " + ManagementFactory.getRuntimeMXBean().getInputArguments());
    if (VersionRetriever.isLocalInfoAvailable()) {
        LOGGER.info("SKADI:   " + VersionRetriever.getLocalVersion() + " " + VersionRetriever.getLocalBuild()
                + " " + VersionRetriever.getLocalTimestamp());
    } else {
        LOGGER.info("SKADI:   " + "No local version info available");
    }
    LOGGER.info("ARGS:    " + Arrays.asList(args));
    LOGGER.info("################################################################################");
}

From source file:jp.co.iidev.subartifact1.divider1.mojo.ArtifactDividerMojo.java

public void execute() throws MojoExecutionException {

    Artifact projArt = project.getArtifact();
    Map<Dependency, Artifact> artifactsForDep = Maps.newHashMap();

    projArt = project.getArtifact();/*from  w  w  w .  j  a va  2s  .c om*/

    {
        List<Dependency> dep = project.getDependencies();
        Set<Artifact> arts = project.getDependencyArtifacts();

        for (Dependency dx : dep) {
            String grpid = dx.getGroupId();
            String artid = dx.getArtifactId();
            String clsf = dx.getClassifier();

            for (Artifact art : arts) {
                boolean a = StringUtils.equals(art.getArtifactId(), artid);
                boolean g = StringUtils.equals(art.getGroupId(), grpid);
                boolean c = StringUtils.equals(art.getClassifier(), clsf);

                if (a && g && c) {
                    artifactsForDep.put(dx, art);
                }
            }
        }
    }

    {
        String version = project.getVersion();
        String groupId = project.getGroupId();

        LinkedHashMap<File, Dependency> compiletimeClasspath = Maps.newLinkedHashMap();

        File rtjar = Paths.get(System.getProperty("java.home"), "lib", "rt.jar").toFile();
        Dependency rtjar_dummyDep = new Dependency();
        {
            rtjar_dummyDep.setGroupId(SystemUtils.JAVA_VENDOR.replace(" ", "."));
            rtjar_dummyDep.setVersion(SystemUtils.JAVA_RUNTIME_VERSION);
            rtjar_dummyDep.setArtifactId(SystemUtils.JAVA_RUNTIME_NAME);
        }

        File targetJar = project.getArtifact().getFile();
        Dependency targetJarDep = new Dependency();
        {
            targetJarDep.setArtifactId(project.getArtifactId());
            targetJarDep.setGroupId(project.getGroupId());
            targetJarDep.setVersion(project.getVersion());
            targetJarDep.setClassifier(projArt.getClassifier());
        }

        compiletimeClasspath.put(rtjar, rtjar_dummyDep);
        compiletimeClasspath.put(targetJar, targetJarDep);
        artifactsForDep.forEach((d, a) -> {
            compiletimeClasspath.put(a.getFile(), d);
        });

        LoggableFactory lf = new LoggableFactory() {
            @Override
            public Loggable createLoggable(Class cx) {
                return new Loggable() {
                    Logger l = LoggerFactory.getLogger(cx);

                    @Override
                    public void warn(String text) {
                        l.warn(text);
                    }

                    @Override
                    public void info(String text) {
                        l.info(text);
                    }

                    @Override
                    public void error(String text) {
                        l.error(text);
                    }

                    @Override
                    public void debug(String text) {
                        l.debug(text);
                    }
                };
            }
        };
        try {
            LinkedHashMap<SubArtifactDefinition, SubArtifactDeployment> buildPlan = new DivisionExecutor(
                    lf.createLoggable(DivisionExecutor.class)).planDivision(targetJar, rootSubArtifactId,
                            Arrays.asList(subartifacts == null ? new SubArtifact[0] : subartifacts),
                            compiletimeClasspath, not(in(ImmutableSet.of(rtjar, targetJar))),
                            defaultRootTransitivePropagations, defaultRootSourceReferencePropagations,
                            defaultSubartifactSourceReferencePropagations, globalReferencePropagations, lf);

            Set<File> usableJar = Sets.newLinkedHashSet(compiletimeClasspath.keySet());
            usableJar.remove(targetJar);
            usableJar.remove(rtjar);

            int ix = 0;
            for (SubArtifact s : subartifacts) {
                for (Dependency d : s.getExtraDependencies()) {
                    buildPlan.get(s).getJarDeps().put(new File("x_xx_xyx_duMmy" + (ix++) + ".jar"), d);
                }
            }

            new PomSetGenerator(project.getBasedir().toPath().resolve("pom.xml"), outputDirectory.toPath(),
                    templateOutputDirectory.toPath(), lf).generate(groupId, version,
                            this.subArtifactsParentArtifactId, buildPlan);
        } catch (RuntimeException e) {
            throw e;
        } catch (Exception e) {
            throw new MojoExecutionException("division process error", e);
        }
    }

}