Package org.gradle.api.plugins

Examples of org.gradle.api.plugins.ApplicationPluginConvention


        SpringBootPluginExtension.class);
    if (bootExtension.getMainClass() != null) {
      mainClass = bootExtension.getMainClass();
    }

    ApplicationPluginConvention application = (ApplicationPluginConvention) project
        .getConvention().getPlugins().get("application");
    // Try the Application extension setting
    if (mainClass == null && application.getMainClassName() != null) {
      mainClass = application.getMainClassName();
    }

    Task runTask = getProject().getTasks().getByName("run");
    if (mainClass == null && runTask.hasProperty("main")) {
      mainClass = (String) runTask.property("main");
    }

    if (mainClass == null) {
      // Search
      SourceSet mainSourceSet = SourceSets.findMainSourceSet(project);
      if (mainSourceSet != null) {
        project.getLogger().debug(
            "Looking for main in: "
                + mainSourceSet.getOutput().getClassesDir());
        try {
          mainClass = MainClassFinder.findSingleMainClass(mainSourceSet
              .getOutput().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.getMainClassName() == null) {
      application.setMainClassName(mainClass);
    }
    if (!runTask.hasProperty("main")) {
      runTask.setProperty("main", mainClass);
    }
View Full Code Here

TOP

Related Classes of org.gradle.api.plugins.ApplicationPluginConvention

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.