org.gradle.api.Project.getComponents()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(3.5k)|赞(0)|评价(0)|浏览(182)

本文整理了Java中org.gradle.api.Project.getComponents()方法的一些代码示例,展示了Project.getComponents()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Project.getComponents()方法的具体详情如下:
包路径:org.gradle.api.Project
类名称:Project
方法名:getComponents

Project.getComponents介绍

暂无

代码示例

代码示例来源:origin: gradle.plugin.com.xenoterracide.gradle/gradle-plugin-bundle

} );
  } );
  pub.from( project.getComponents().getAt( "java" ) );
  pub.artifact( provider.get() );
} );

代码示例来源:origin: gradle.plugin.com.xenoterracide.gradle/pluginbundle

} );
  } );
  pub.from( project.getComponents().getAt( "java" ) );
  pub.artifact( provider.get() );
} );

代码示例来源:origin: gradle.plugin.com.xenoterracide/gradle-mirror

} );
  } );
  pub.from( project.getComponents().getAt( "java" ) );
  pub.artifact( provider.get() );
} );

代码示例来源:origin: org.shipkit/shipkit

public void apply(final Project project) {
    final ShipkitConfiguration conf = project.getPlugins().apply(ShipkitConfigurationPlugin.class).getConfiguration();

    project.getPlugins().apply(LocalSnapshotPlugin.class);
    Task snapshotTask = project.getTasks().getByName(LocalSnapshotPlugin.SNAPSHOT_TASK);
    snapshotTask.dependsOn(MAVEN_LOCAL_TASK);

    project.getPlugins().apply(JavaLibraryPlugin.class);
    project.getPlugins().apply("maven-publish");

    final Jar sourcesJar = (Jar) project.getTasks().getByName(JavaLibraryPlugin.SOURCES_JAR_TASK);
    final Jar javadocJar = (Jar) project.getTasks().getByName(JavaLibraryPlugin.JAVADOC_JAR_TASK);

    GradleDSLHelper.publications(project, publications -> {
      MavenPublication p = publications.create(PUBLICATION_NAME, MavenPublication.class, publication -> {
        publication.from(project.getComponents().getByName("java"));
        publication.artifact(sourcesJar);
        publication.artifact(javadocJar);
        DeferredConfiguration.deferredConfiguration(project, () -> {
          publication.setArtifactId(((Jar) project.getTasks().getByName("jar")).getBaseName());
        });
        PomCustomizer.customizePom(project, conf, publication);
      });
      LOG.info("{} - configured '{}' publication", project.getPath(), p.getArtifactId());
    });

    //so that we flesh out problems with maven publication during the build process
    project.getTasks().getByName("build").dependsOn(MAVEN_LOCAL_TASK);
  }
}

代码示例来源:origin: mockito/shipkit

public void apply(final Project project) {
    final ShipkitConfiguration conf = project.getPlugins().apply(ShipkitConfigurationPlugin.class).getConfiguration();

    project.getPlugins().apply(LocalSnapshotPlugin.class);
    Task snapshotTask = project.getTasks().getByName(LocalSnapshotPlugin.SNAPSHOT_TASK);
    snapshotTask.dependsOn(MAVEN_LOCAL_TASK);

    project.getPlugins().apply(JavaLibraryPlugin.class);
    project.getPlugins().apply("maven-publish");

    final Jar sourcesJar = (Jar) project.getTasks().getByName(JavaLibraryPlugin.SOURCES_JAR_TASK);
    final Jar javadocJar = (Jar) project.getTasks().getByName(JavaLibraryPlugin.JAVADOC_JAR_TASK);

    GradleDSLHelper.publications(project, publications -> {
      MavenPublication p = publications.create(PUBLICATION_NAME, MavenPublication.class, publication -> {
        publication.from(project.getComponents().getByName("java"));
        publication.artifact(sourcesJar);
        publication.artifact(javadocJar);
        DeferredConfiguration.deferredConfiguration(project, () -> {
          publication.setArtifactId(((Jar) project.getTasks().getByName("jar")).getBaseName());
        });
        PomCustomizer.customizePom(project, conf, publication);
      });
      LOG.info("{} - configured '{}' publication", project.getPath(), p.getArtifactId());
    });

    //so that we flesh out problems with maven publication during the build process
    project.getTasks().getByName("build").dependsOn(MAVEN_LOCAL_TASK);
  }
}

相关文章