JavadocJarPlugin implements Plugin<Project> { @Override public void apply(Project project) { project.getPlugins().withType(JavaPlugin.class, javaPlugin -> { project.getLogger().warn("io.freefair.javadoc-jar is deprecated. Use java.withJavadocJar() instead"); javadocJar = project.getTasks().register("javadocJar", Jar.class, javadocJar -> { javadocJar.from(project.getTasks().named(JavaPlugin.JAVADOC_TASK_NAME)); javadocJar.getArchiveClassifier().set("javadoc"); javadocJar.setDescription("Assembles a jar archive containing the javadocs."); javadocJar.setGroup(BasePlugin.BUILD_GROUP); }); project.getArtifacts().add(Dependency.ARCHIVES_CONFIGURATION, javadocJar); }); project.getPlugins().withType(AggregateJavadocPlugin.class, aggregateJavadocPlugin -> { aggregateJavadocJar = project.getTasks().register("aggregateJavadocJar", Jar.class, aggregateJavadocJar -> { aggregateJavadocJar.from(aggregateJavadocPlugin.getAggregateJavadoc()); aggregateJavadocJar.getArchiveClassifier().set("javadoc"); aggregateJavadocJar.setGroup(BasePlugin.BUILD_GROUP); }); project.getPlugins().apply(BasePlugin.class); project.getArtifacts().add(Dependency.ARCHIVES_CONFIGURATION, aggregateJavadocJar); project.getPlugins().withType(JavaPlugin.class, javaPlugin -> { aggregateJavadocJar.configure(aggregateJavadocJar -> { aggregateJavadocJar.getArchiveClassifier().convention("aggregateJavadoc"); aggregateJavadocJar.getDestinationDirectory().set(new File( project.getConvention().getPlugin(JavaPluginConvention.class).getDocsDir(), "aggregateJavadoc" )); }); }); }); }  @Override void apply(Project project);  }
@Test public void apply() { project.getPlugins().apply(JavadocJarPlugin.class); }
@Test public void apply_java() { project.getPlugins().apply(JavaPlugin.class); project.getPlugins().apply(JavadocJarPlugin.class); }