Java 类org.gradle.api.plugins.ApplicationPluginConvention 实例源码

项目:wildfly-swarm    文件:PackageTask.java   
@Input
@Optional
private String getMainClassName() {
    Project project = getProject();
    SwarmExtension swarmExtension = getSwarmExtension();
    String mainClassName = swarmExtension.getMainClassName();

    if (mainClassName == null && project.getConvention().getPlugins().containsKey("application")) {
        ApplicationPluginConvention app = (ApplicationPluginConvention) project.getConvention().getPlugins().get("application");
        mainClassName = app.getMainClassName();
    }

    if (mainClassName != null && !mainClassName.equals("")) {
        getLogger().warn(
                "\n------\n" +
                        "Custom main() usage is intended to be deprecated in a future release and is no longer supported, \n" +
                        "please refer to http://reference.wildfly-swarm.io for YAML configuration that replaces it." +
                        "\n------"
        );
    }

    return mainClassName;
}
项目:purplejs    文件:BootPlugin.java   
private void configureAppPlugin()
{
    final ApplicationPluginConvention convention = this.project.getConvention().findPlugin( ApplicationPluginConvention.class );
    convention.setMainClassName( "io.purplejs.boot.MainApp" );

    final JavaExec runTask = (JavaExec) this.project.getTasks().getByName( ApplicationPlugin.TASK_RUN_NAME );
    runTask.systemProperty( "io.purplejs.runMode", "dev" );

    final String devDirs = new File( this.project.getProjectDir(), "src/main/resources" ).getAbsolutePath();
    runTask.systemProperty( "io.purplejs.devSourceDirs", devDirs );
}
项目:curiostack    文件:CurioServerPlugin.java   
@Override
public void apply(Project project) {
  project.getPluginManager().apply(ApplicationPlugin.class);
  project.getPluginManager().apply(GitPropertiesPlugin.class);
  project
      .getExtensions()
      .create(ImmutableDeploymentExtension.NAME, DeploymentExtension.class, project);

  project.getNormalization().getRuntimeClasspath().ignore("git.properties");

  project.afterEvaluate(
      p -> {
        ImmutableDeploymentExtension config =
            project.getExtensions().getByType(DeploymentExtension.class);

        String archivesBaseName =
            project.getConvention().getPlugin(BasePluginConvention.class).getArchivesBaseName();
        project
            .getConvention()
            .getPlugin(ApplicationPluginConvention.class)
            .setApplicationName(archivesBaseName);

        GroovyObject docker = project.getExtensions().getByType(DockerExtension.class);
        DockerJavaApplication javaApplication =
            (DockerJavaApplication) docker.getProperty("javaApplication");
        javaApplication.setBaseImage("openjdk:8-jre");

        project.getTasks().getByName("build").dependsOn("dockerDistTar");

        for (ImmutableDeploymentConfiguration type : config.getTypes()) {
          String capitalized =
              Ascii.toUpperCase(type.getName().charAt(0)) + type.getName().substring(1);
          DeployConfigMapTask deployConfigMapTask =
              project
                  .getTasks()
                  .create("deployConfigMap" + capitalized, DeployConfigMapTask.class)
                  .setType(type.getName());
          project
              .getTasks()
              .create("deploy" + capitalized, DeployPodTask.class)
              .setType(type.getName())
              .dependsOn(deployConfigMapTask);
        }
      });
  project.getPluginManager().apply(DockerJavaApplicationPlugin.class);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:FindMainClassTask.java   
private String findMainClass() {
    Project project = getProject();

    String mainClass = null;

    // Try the SpringBoot extension setting
    SpringBootPluginExtension bootExtension = project.getExtensions()
            .getByType(SpringBootPluginExtension.class);
    if (bootExtension.getMainClass() != null) {
        mainClass = bootExtension.getMainClass();
    }

    ApplicationPluginConvention application = (ApplicationPluginConvention) project
            .getConvention().getPlugins().get("application");

    if (mainClass == null && application != null) {
        // Try the Application extension setting
        mainClass = application.getMainClassName();
    }

    JavaExec runTask = findRunTask(project);
    if (mainClass == null && runTask != null) {
        mainClass = runTask.getMain();
    }

    if (mainClass == null) {
        Task bootRunTask = project.getTasks().findByName("bootRun");
        if (bootRunTask != null) {
            mainClass = (String) bootRunTask.property("main");
        }
    }

    if (mainClass == null) {
        // Search
        if (this.mainClassSourceSetOutput != null) {
            project.getLogger().debug("Looking for main in: "
                    + this.mainClassSourceSetOutput.getClassesDir());
            try {
                mainClass = MainClassFinder.findSingleMainClass(
                        this.mainClassSourceSetOutput.getClassesDir());
                project.getLogger().info("Computed main class: " + mainClass);
            }
            catch (IOException ex) {
                throw new IllegalStateException("Cannot find main class", ex);
            }
        }
    }

    project.getLogger().info("Found main: " + mainClass);

    if (bootExtension.getMainClass() == null) {
        bootExtension.setMainClass(mainClass);
    }
    if (application != null && application.getMainClassName() == null) {
        application.setMainClassName(mainClass);
    }
    if (runTask != null && !runTask.hasProperty("main")) {
        runTask.setMain(mainClass);
    }

    return mainClass;
}
项目:spring-boot-concourse    文件:FindMainClassTask.java   
private String findMainClass() {
    Project project = getProject();

    String mainClass = null;

    // Try the SpringBoot extension setting
    SpringBootPluginExtension bootExtension = project.getExtensions()
            .getByType(SpringBootPluginExtension.class);
    if (bootExtension.getMainClass() != null) {
        mainClass = bootExtension.getMainClass();
    }

    ApplicationPluginConvention application = (ApplicationPluginConvention) project
            .getConvention().getPlugins().get("application");

    if (mainClass == null && application != null) {
        // Try the Application extension setting
        mainClass = application.getMainClassName();
    }

    JavaExec runTask = findRunTask(project);
    if (mainClass == null && runTask != null) {
        mainClass = runTask.getMain();
    }

    if (mainClass == null) {
        Task bootRunTask = project.getTasks().findByName("bootRun");
        if (bootRunTask != null) {
            mainClass = (String) bootRunTask.property("main");
        }
    }

    if (mainClass == null) {
        // Search
        if (this.mainClassSourceSetOutput != null) {
            project.getLogger().debug("Looking for main in: "
                    + this.mainClassSourceSetOutput.getClassesDir());
            try {
                mainClass = MainClassFinder.findSingleMainClass(
                        this.mainClassSourceSetOutput.getClassesDir());
                project.getLogger().info("Computed main class: " + mainClass);
            }
            catch (IOException ex) {
                throw new IllegalStateException("Cannot find main class", ex);
            }
        }
    }

    project.getLogger().info("Found main: " + mainClass);

    if (bootExtension.getMainClass() == null) {
        bootExtension.setMainClass(mainClass);
    }
    if (application != null && application.getMainClassName() == null) {
        application.setMainClassName(mainClass);
    }
    if (runTask != null && !runTask.hasProperty("main")) {
        runTask.setMain(mainClass);
    }

    return mainClass;
}
项目:contestparser    文件:FindMainClassTask.java   
private String findMainClass() {
    Project project = getProject();

    String mainClass = null;

    // Try the SpringBoot extension setting
    SpringBootPluginExtension bootExtension = project.getExtensions()
            .getByType(SpringBootPluginExtension.class);
    if (bootExtension.getMainClass() != null) {
        mainClass = bootExtension.getMainClass();
    }

    ApplicationPluginConvention application = (ApplicationPluginConvention) project
            .getConvention().getPlugins().get("application");

    if (mainClass == null && application != null) {
        // Try the Application extension setting
        mainClass = application.getMainClassName();
    }

    Task runTask = project.getTasks().findByName("run");
    if (mainClass == null && runTask != null) {
        mainClass = (String) runTask.property("main");
    }

    if (mainClass == null) {
        Task bootRunTask = project.getTasks().findByName("bootRun");
        if (bootRunTask != null) {
            mainClass = (String) bootRunTask.property("main");
        }
    }

    if (mainClass == null) {
        // Search
        if (this.mainClassSourceSetOutput != null) {
            project.getLogger().debug("Looking for main in: "
                    + this.mainClassSourceSetOutput.getClassesDir());
            try {
                mainClass = MainClassFinder.findSingleMainClass(
                        this.mainClassSourceSetOutput.getClassesDir());
                project.getLogger().info("Computed main class: " + mainClass);
            }
            catch (IOException ex) {
                throw new IllegalStateException("Cannot find main class", ex);
            }
        }
    }

    project.getLogger().info("Found main: " + mainClass);

    if (bootExtension.getMainClass() == null) {
        bootExtension.setMainClass(mainClass);
    }
    if (application != null && application.getMainClassName() == null) {
        application.setMainClassName(mainClass);
    }
    if (runTask != null && !runTask.hasProperty("main")) {
        runTask.setProperty("main", mainClass);
    }

    return mainClass;
}