org.wildfly.swarm.tools.exec.SwarmExecutor Java Examples

The following examples show how to use org.wildfly.swarm.tools.exec.SwarmExecutor. 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: StartTask.java    From thorntail with Apache License 2.0 6 votes vote down vote up
private SwarmExecutor warExecutor() {
    getLogger().info("Creating WAR Thorntail executor.");

    final String finalName = ThorntailUtils.getArchiveTask(getProject()).getArchiveName();

    final SwarmExecutor executor = new SwarmExecutor()
            .withModules(getModules())
            .withProperty(BootstrapProperties.APP_NAME, finalName)
            .withClassPathEntries(getClassPathEntries(Collections.singletonList(getArchivePath().toPath()), false));

    if (extension.getMainClassName() != null) {
        getLogger().info("With Thorntail app main class " + extension.getMainClassName());
        executor.withMainClass(extension.getMainClassName());
    } else {
        getLogger().info("With default Thorntail app main class.");
        executor.withDefaultMainClass();
    }

    executor.withProperty(BootstrapProperties.APP_PATH, getArchivePath().getPath());
    return executor;
}
 
Example #2
Source File: StartMojo.java    From ARCHIVE-wildfly-swarm with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("ThrowableResultOfMethodCallIgnored")
protected SwarmExecutor warExecutor() throws MojoFailureException {
    getLog().info("Starting .war");

    String finalName = this.project.getBuild().getFinalName();
    if (!finalName.endsWith(".war")) {
        finalName = finalName + ".war";
    }

    return new SwarmExecutor()
            .withModules(expandModules())
            .withClassPathEntries(dependencies(false))
            .withProperty(BootstrapProperties.APP_PATH,
                    Paths.get(this.projectBuildDir, finalName).toString())
            .withDefaultMainClass();
}
 
Example #3
Source File: StartMojo.java    From ARCHIVE-wildfly-swarm with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("ThrowableResultOfMethodCallIgnored")
protected SwarmExecutor jarExecutor() throws MojoFailureException {
    getLog().info("Starting .jar");

    final SwarmExecutor executor = new SwarmExecutor()
            .withModules(expandModules())
            .withClassPathEntries(dependencies(true));

    if (this.mainClass != null) {
        executor.withMainClass(this.mainClass);
    } else {
        executor.withDefaultMainClass();
    }

    return executor;
}
 
Example #4
Source File: StartMojo.java    From wildfly-swarm with Apache License 2.0 5 votes vote down vote up
protected SwarmExecutor uberJarExecutor() throws MojoFailureException {
    getLog().info("Starting -swarm.jar");

    String finalName = this.project.getBuild().getFinalName();

    if (finalName.endsWith(".war") || finalName.endsWith(".jar")) {
        finalName = finalName.substring(0, finalName.length() - 4);
    }

    return new SwarmExecutor()
            .withExecutableJar(Paths.get(this.projectBuildDir, finalName + "-swarm.jar"));
}
 
Example #5
Source File: StartMojo.java    From wildfly-swarm with Apache License 2.0 5 votes vote down vote up
protected SwarmExecutor warExecutor() throws MojoFailureException {
    getLog().info("Starting .war");

    String finalName = this.project.getBuild().getFinalName();
    if (!finalName.endsWith(".war")) {
        finalName = finalName + ".war";
    }

    return executor(Paths.get(this.projectBuildDir, finalName), finalName, false);
}
 
Example #6
Source File: StartMojo.java    From wildfly-swarm with Apache License 2.0 5 votes vote down vote up
protected SwarmExecutor jarExecutor() throws MojoFailureException {
    getLog().info("Starting .jar");

    final String finalName = this.project.getBuild().getFinalName();

    return executor(Paths.get(this.project.getBuild().getOutputDirectory()),
                    finalName.endsWith(".jar") ? finalName : finalName + ".jar",
                    true);
}
 
Example #7
Source File: StartTask.java    From thorntail with Apache License 2.0 5 votes vote down vote up
private SwarmExecutor jarExecutor() {
        getLogger().info("Creating WAR Thorntail executor.");

        final String finalName = ThorntailUtils.getArchiveTask(getProject()).getArchiveName();

        // TODO: application path could possibly contain more classesDirs
        // TODO: getClassesDir() no longer exists in gradle 4+?, gradle-plugins dep should be upgraded, but current
        // version is not available as a maven artifact
//        getProject().getConvention().getPlugin(JavaPluginConvention.class).getSourceSets()
//                .getByName(SourceSet.MAIN_SOURCE_SET_NAME).getOutput().getClassesDir();
        final List<Path> sourcePaths = Arrays.asList(getProject().getBuildDir().toPath().resolve("classes/java/main"),
                getProject().getBuildDir().toPath().resolve("resources/main"));
        getLogger().info("Source paths: {}", sourcePaths);

        final SwarmExecutor executor = new SwarmExecutor()
                .withModules(getModules())
                .withProperty(BootstrapProperties.APP_NAME, finalName)
                .withClassPathEntries(sourcePaths)
                .withClassPathEntries(getClassPathEntries(sourcePaths, true));

        if (extension.getMainClassName() != null) {
            getLogger().info("With Thorntail app main class " + extension.getMainClassName());
            executor.withMainClass(extension.getMainClassName());
        } else {
            getLogger().info("With default Thorntail app main class.");
            executor.withDefaultMainClass();
        }

        return executor;
    }
 
Example #8
Source File: StartMojo.java    From thorntail with Apache License 2.0 5 votes vote down vote up
protected SwarmExecutor uberJarExecutor() throws MojoFailureException {
    getLog().info("Starting uberjar");

    String finalName = this.project.getBuild().getFinalName();

    if (finalName.endsWith(WAR_FILE_EXTENSION) || finalName.endsWith(JAR_FILE_EXTENSION)) {
        finalName = finalName.substring(0, finalName.length() - 4);
    }

    return new SwarmExecutor()
            .withExecutableJar(Paths.get(this.projectBuildDir, finalName + "-" + PackageMojo.UBERJAR_SUFFIX + JAR_FILE_EXTENSION));
}
 
Example #9
Source File: StartMojo.java    From thorntail with Apache License 2.0 5 votes vote down vote up
protected SwarmExecutor warExecutor() throws MojoFailureException {
    getLog().info("Starting .war");

    String finalName = this.project.getBuild().getFinalName();
    if (!finalName.endsWith(WAR_FILE_EXTENSION)) {
        finalName = finalName + WAR_FILE_EXTENSION;
    }

    Path warPath = Paths.get(this.projectBuildDir, finalName);
    SwarmExecutor executor = executor(warPath, finalName, false);
    // Specify swarm.app.path property so that repackaged war is used
    executor.withProperty(BootstrapProperties.APP_PATH, warPath.toString());
    return executor;
}
 
Example #10
Source File: StartMojo.java    From thorntail with Apache License 2.0 5 votes vote down vote up
protected SwarmExecutor jarExecutor() throws MojoFailureException {
    getLog().info("Starting .jar");

    final String finalName = this.project.getBuild().getFinalName();

    return executor(Paths.get(this.project.getBuild().getOutputDirectory()),
                    finalName.endsWith(JAR_FILE_EXTENSION) ? finalName : finalName + JAR_FILE_EXTENSION,
                    true);
}
 
Example #11
Source File: StartMojo.java    From ARCHIVE-wildfly-swarm with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("ThrowableResultOfMethodCallIgnored")
protected SwarmExecutor uberJarExecutor() throws MojoFailureException {
    getLog().info("Starting -swarm.jar");

    String finalName = this.project.getBuild().getFinalName();

    if (finalName.endsWith(".war") || finalName.endsWith(".jar")) {
        finalName = finalName.substring(0, finalName.length() - 4);
    }

    return new SwarmExecutor()
            .withExecutableJar(Paths.get(this.projectBuildDir, finalName + "-swarm.jar"));
}
 
Example #12
Source File: StartTask.java    From thorntail with Apache License 2.0 4 votes vote down vote up
private SwarmExecutor uberJarExecutor() {
    getLogger().info("Creating uber-jar Thorntail executor.");
    return new SwarmExecutor().withExecutableJar(getUberJarArchivePath().toPath());
}