Java JavaLibrary类代码示例

本文整理汇总了Java中org.gradle.api.internal.java.JavaLibrary的典型用法代码示例。如果您正苦于以下问题:Java JavaLibrary类的具体用法?Java JavaLibrary怎么用?Java JavaLibrary使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Java JavaLibrary类代码示例

JavaLibrary类属于org.gradle.api.internal.java包,在下文中一共展示了JavaLibrary类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: configureArchivesAndComponent

import org.gradle.api.internal.java.JavaLibrary; //导入依赖的package包/类
private void configureArchivesAndComponent(final Project project, final JavaPluginConvention pluginConvention) {
    Jar jar = project.getTasks().create(JAR_TASK_NAME, Jar.class);
    jar.getManifest().from(pluginConvention.getManifest());
    jar.setDescription("Assembles a jar archive containing the main classes.");
    jar.setGroup(BasePlugin.BUILD_GROUP);
    jar.from(pluginConvention.getSourceSets().getByName(SourceSet.MAIN_SOURCE_SET_NAME).getOutput());
    jar.getMetaInf().from(new Callable() {
        public Object call() throws Exception {
            return pluginConvention.getMetaInf();
        }
    });

    ArchivePublishArtifact jarArtifact = new ArchivePublishArtifact(jar);
    Configuration runtimeConfiguration = project.getConfigurations().getByName(RUNTIME_CONFIGURATION_NAME);

    runtimeConfiguration.getArtifacts().add(jarArtifact);
    project.getExtensions().getByType(DefaultArtifactPublicationSet.class).addCandidate(jarArtifact);
    project.getComponents().add(new JavaLibrary(jarArtifact, runtimeConfiguration.getAllDependencies()));
} 
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:20,代码来源:JavaPlugin.java

示例2: configureArchivesAndComponent

import org.gradle.api.internal.java.JavaLibrary; //导入依赖的package包/类
private void configureArchivesAndComponent(final Project project, final JavaPluginConvention pluginConvention) {
    Jar jar = project.getTasks().create(JAR_TASK_NAME, Jar.class);
    jar.setDescription("Assembles a jar archive containing the main classes.");
    jar.setGroup(BasePlugin.BUILD_GROUP);
    jar.from(pluginConvention.getSourceSets().getByName(SourceSet.MAIN_SOURCE_SET_NAME).getOutput());

    ArchivePublishArtifact jarArtifact = new ArchivePublishArtifact(jar);
    Configuration runtimeConfiguration = project.getConfigurations().getByName(RUNTIME_CONFIGURATION_NAME);

    runtimeConfiguration.getArtifacts().add(jarArtifact);
    project.getExtensions().getByType(DefaultArtifactPublicationSet.class).addCandidate(jarArtifact);
    project.getComponents().add(new JavaLibrary(jarArtifact, runtimeConfiguration.getAllDependencies()));
} 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:14,代码来源:JavaPlugin.java

示例3: createPublications

import org.gradle.api.internal.java.JavaLibrary; //导入依赖的package包/类
/**
 * Create the default Maven publication
 *
 * @param publishingExtension Publishing extension where the publication is created
 * @param projectContext Project context to access project information
 * @param projectConfig Project configuration
 * @param mavenConfig Maven configuration
 * @param configurations Container to access configurations
 * @param services Service manager to obtain service objects
 */
@Mutate
public void createPublications(PublishingExtension publishingExtension, ProjectContext projectContext,
        ProjectConfig projectConfig, MavenConfig mavenConfig, ConfigurationContainer configurations,
        ServiceRegistry services) {
    SoftwareComponentContainer components = services.get(SoftwareComponentContainer.class);
    JavaLibrary javaComponent = components.withType(JavaLibrary.class).getByName("java");

    for (MavenPublicationConfig publicationConfig : mavenConfig.getPublications()) {
        Configuration configuration = configurations
                .getByName(publicationConfig.getArchivesConfiguration());

        publishingExtension.getPublications().create(publicationConfig.getName(), MavenPublication.class,
                p -> {
                    p.setArtifactId(publicationConfig.getArtifactId());

                    List<@NonNull Configuration> runtimeConfigurations = publicationConfig
                            .getRuntimeConfigurations().stream().map(c -> configurations.getByName(c))
                            .collect(Collectors.toList());

                    List<@NonNull Configuration> compileConfigurations = publicationConfig
                            .getCompileConfigurations().stream().map(c -> configurations.getByName(c))
                            .collect(Collectors.toList());

                    List<@NonNull PublishArtifact> artifacts = Collections.emptyList();

                    if (publicationConfig.isAddProjectArtifacts()) {
                        artifacts = javaComponent.getUsages().stream()
                                .flatMap(u -> u.getArtifacts().stream()).collect(Collectors.toList());
                    }

                    PomConfigurator configurator = new PomConfigurator(projectContext, projectConfig,
                            Validate.notNull(runtimeConfigurations),
                            Validate.notNull(compileConfigurations));

                    p.pom(pom -> pom.withXml(xml -> configurator.configurePom(Validate.notNull(xml))));

                    for (PublishArtifact a : configuration.getArtifacts()) {
                        p.artifact(a);
                    }
                });
    }
} 
开发者ID:jochenseeber,项目名称:gradle-project-config,代码行数:53,代码来源:MavenConfigPlugin.java

本文标签属性:

示例:示例英语

代码:代码大全可复制

java:java面试题

JavaLibrary:JavaLibrary

上一篇:C++ CJob::QueryExtendedLimitInfo方法代码示例
下一篇:世界著名摄影大师有哪些?(中国十大顶级摄影师)

为您推荐