Package org.gradle.api.plugins

Examples of org.gradle.api.plugins.JavaPluginConvention


   */
  private void configureDefaultResourcesDirectory(final Project project, final IConventionAware conventionAwareRebelTask) {
    conventionAwareRebelTask.getConventionMapping().map(RebelGenerateTask.NAME_DEFAULT_RESOURCES_DIRECTORY, new Callable<Object>() {
      public Object call() {
        try {
          JavaPluginConvention javaConvention = project.getConvention().getPlugin(JavaPluginConvention.class);
          return javaConvention.getSourceSets().getByName("main").getOutput().getResourcesDir();
        }
        catch (Exception e) {
          return null;
        }
      }
View Full Code Here


    }
    return null;
  }

  private static Iterable<SourceSet> getJavaSourceSets(Project project) {
    JavaPluginConvention plugin = project.getConvention().getPlugin(
        JavaPluginConvention.class);
    if (plugin == null) {
      return Collections.emptyList();
    }
    return plugin.getSourceSets();
  }
View Full Code Here

      }
    });
  }

  private void addBootRunTask(final Project project) {
    final JavaPluginConvention javaConvention = project.getConvention().getPlugin(
        JavaPluginConvention.class);

    BootRunTask run = project.getTasks().create(RUN_APP_TASK_NAME, BootRunTask.class);
    run.setDescription("Run the project with support for "
        + "auto-detecting main class and reloading static resources");
    run.setGroup("application");
    run.setClasspath(javaConvention.getSourceSets().findByName("main")
        .getRuntimeClasspath());
    run.getConventionMapping().map("main", new Callable<Object>() {
      @Override
      public Object call() throws Exception {
        return project.property("mainClassName");
View Full Code Here

            properties.put("sonar.working.directory", new File(project.getBuildDir(), "sonar"));
        }

        project.getPlugins().withType(JavaBasePlugin.class, new Action<JavaBasePlugin>() {
            public void execute(JavaBasePlugin javaBasePlugin) {
                JavaPluginConvention javaPluginConvention = new DslObject(project).getConvention().getPlugin(JavaPluginConvention.class);
                properties.put("sonar.java.source", javaPluginConvention.getSourceCompatibility());
                properties.put("sonar.java.target", javaPluginConvention.getTargetCompatibility());
            }
        });

        project.getPlugins().withType(JavaPlugin.class, new Action<JavaPlugin>() {
            public void execute(JavaPlugin javaPlugin) {
                JavaPluginConvention javaPluginConvention = new DslObject(project).getConvention().getPlugin(JavaPluginConvention.class);

                SourceSet main = javaPluginConvention.getSourceSets().getAt("main");
                List<File> sourceDirectories = nonEmptyOrNull(Iterables.filter(main.getAllSource().getSrcDirs(), FILE_EXISTS));
                properties.put("sonar.sources" , sourceDirectories);
                SourceSet test = javaPluginConvention.getSourceSets().getAt("test");
                List<File> testDirectories = nonEmptyOrNull(Iterables.filter(test.getAllSource().getSrcDirs(), FILE_EXISTS));
                properties.put("sonar.tests", testDirectories);

                properties.put("sonar.binaries", nonEmptyOrNull(Iterables.filter(main.getRuntimeClasspath(), IS_DIRECTORY)));
                properties.put("sonar.libraries", getLibraries(main));
View Full Code Here

    }

    private void configureWithJavaPluginApplied(final Project project, final EarPluginConvention earPluginConvention, PluginContainer plugins) {
        plugins.withType(JavaPlugin.class, new Action<JavaPlugin>() {
            public void execute(JavaPlugin javaPlugin) {
                final JavaPluginConvention javaPluginConvention = project.getConvention().findPlugin(JavaPluginConvention.class);

                SourceSet sourceSet = javaPluginConvention.getSourceSets().getByName(SourceSet.MAIN_SOURCE_SET_NAME);
                sourceSet.getResources().srcDir(new Callable() {
                    public Object call() throws Exception {
                        return earPluginConvention.getAppDirName();
                    }
                });
                project.getTasks().withType(Ear.class, new Action<Ear>() {
                    public void execute(final Ear task) {
                        task.dependsOn(new Callable<FileCollection>() {
                            public FileCollection call() throws Exception {
                                return javaPluginConvention.getSourceSets().getByName(SourceSet.MAIN_SOURCE_SET_NAME)
                                        .getRuntimeClasspath();
                            }
                        });
                        task.from(new Callable<FileCollection>() {
                            public FileCollection call() throws Exception {
                                return javaPluginConvention.getSourceSets().getByName(SourceSet.MAIN_SOURCE_SET_NAME).getOutput();
                            }
                        });
                    }
                });
            }
View Full Code Here

TOP

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

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.