当前位置: 首页>>代码示例>>Java>>正文


Java Artifact类代码示例

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


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

示例1: deployEffectivePom

import org.apache.ivy.core.module.descriptor.Artifact; //导入依赖的package包/类
private void deployEffectivePom( ModuleRevisionId moduleRevisionId, Path artifactPath )
    throws IOException
{
    try
    {
        File pomFile = artifactPath.resolveSibling( artifactPath.getName( artifactPath.getNameCount() - 1 )
            + "-xmvn.pom" ).toFile();
        ModuleDescriptorParser parser = XmlModuleDescriptorParser.getInstance();
        ModuleDescriptor module =
            parser.parseDescriptor( getSettings(), artifactPath.toFile().toURI().toURL(), false );
        PomModuleDescriptorWriter.write( module, pomFile, new PomWriterOptions() );

        org.fedoraproject.xmvn.artifact.Artifact artifact = ivy2aether( moduleRevisionId, "pom" );
        deploy( artifact, null, artifactPath );
    }
    catch ( ParseException e )
    {
        throw new IOException( e );
    }
}
 
开发者ID:fedora-java,项目名称:xmvn,代码行数:21,代码来源:IvyResolver.java

示例2: populateModuleDescriptorWithPublication

import org.apache.ivy.core.module.descriptor.Artifact; //导入依赖的package包/类
static void populateModuleDescriptorWithPublication(DefaultModuleDescriptor descriptor,
        JkMavenPublication publication, Instant publishDate) {

    final ModuleRevisionId moduleRevisionId = descriptor.getModuleRevisionId();
    final String artifactName = moduleRevisionId.getName();
    final Artifact mavenMainArtifact = toPublishedMavenArtifact(publication.mainArtifactFiles()
            .get(0), artifactName, null, moduleRevisionId, publishDate);
    final String mainConf = "default";
    populateDescriptorWithMavenArtifact(descriptor, mainConf, mavenMainArtifact);

    for (final JkClassifiedFileArtifact artifactEntry : publication.classifiedArtifacts()) {
        final Path file = artifactEntry.file();
        final String classifier = artifactEntry.classifier();
        final Artifact mavenArtifact = toPublishedMavenArtifact(file, artifactName, classifier,
                descriptor.getModuleRevisionId(), publishDate);
        populateDescriptorWithMavenArtifact(descriptor, classifier, mavenArtifact);
    }
}
 
开发者ID:jerkar,项目名称:jerkar,代码行数:19,代码来源:IvyTranslations.java

示例3: populateArtifactsFromDescriptor

import org.apache.ivy.core.module.descriptor.Artifact; //导入依赖的package包/类
private void populateArtifactsFromDescriptor() {
    Map<Artifact, ModuleComponentArtifactMetaData> artifactToMetaData = Maps.newLinkedHashMap();
    for (Artifact descriptorArtifact : getDescriptor().getAllArtifacts()) {
        ModuleComponentArtifactMetaData artifact = artifact(descriptorArtifact);
        artifactToMetaData.put(descriptorArtifact, artifact);
    }

    artifacts = Sets.newLinkedHashSet(artifactToMetaData.values());

    this.artifactsByConfig = LinkedHashMultimap.create();
    for (String configuration : getDescriptor().getConfigurationsNames()) {
        Artifact[] configArtifacts = getDescriptor().getArtifacts(configuration);
        for (Artifact configArtifact : configArtifacts) {
            artifactsByConfig.put(configuration, artifactToMetaData.get(configArtifact));
        }
    }
}
 
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:18,代码来源:AbstractModuleComponentResolveMetaData.java

示例4: addArtifact

import org.apache.ivy.core.module.descriptor.Artifact; //导入依赖的package包/类
public void addArtifact(IvyArtifactName newArtifact, Set<String> configurations) {
    if (configurations.isEmpty()) {
        throw new IllegalArgumentException("Artifact should be attached to at least one configuration.");
    }

    MDArtifact unattached = new MDArtifact(module, newArtifact.getName(), newArtifact.getType(), newArtifact.getExtension(), null, newArtifact.getAttributes());
    //Adding the artifact will replace any existing artifact
    //This potentially leads to loss of information - the configurations of the replaced artifact are lost (see GRADLE-123)
    //Hence we attempt to find an existing artifact and merge the information
    Artifact[] allArtifacts = module.getAllArtifacts();
    for (Artifact existing : allArtifacts) {
        // Can't just compare the raw IvyArtifactName, since creating MDArtifact creates a bunch of attributes
        if (artifactsEqual(unattached, existing)) {
            if (!(existing instanceof MDArtifact)) {
                throw new IllegalArgumentException("Cannot update an existing artifact (" + existing + ") in provided module descriptor (" + module + ")"
                        + " because the artifact is not an instance of MDArtifact." + module);
            }
            attachArtifact((MDArtifact) existing, configurations, module);
            return; //there is only one matching artifact
        }
    }
    attachArtifact(unattached, configurations, module);
}
 
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:24,代码来源:BuildableIvyModuleResolveMetaData.java

示例5: publish

import org.apache.ivy.core.module.descriptor.Artifact; //导入依赖的package包/类
public void publish(IvyNormalizedPublication publication, PublicationAwareRepository repository) {
    ModuleVersionPublisher publisher = repository.createPublisher();
    IvyPublicationIdentity projectIdentity = publication.getProjectIdentity();
    ModuleRevisionId moduleRevisionId = IvyUtil.createModuleRevisionId(projectIdentity.getOrganisation(), projectIdentity.getModule(), projectIdentity.getRevision());
    ModuleVersionIdentifier moduleVersionIdentifier = DefaultModuleVersionIdentifier.newId(moduleRevisionId);
    DefaultIvyModulePublishMetaData publishMetaData = new DefaultIvyModulePublishMetaData(moduleVersionIdentifier);

    try {
        for (IvyArtifact publishArtifact : publication.getArtifacts()) {
            Artifact ivyArtifact = createIvyArtifact(publishArtifact, moduleRevisionId);
            publishMetaData.addArtifact(ivyArtifact, publishArtifact.getFile());
        }

        Artifact artifact = DefaultArtifact.newIvyArtifact(moduleRevisionId, null);
        publishMetaData.addArtifact(artifact, publication.getDescriptorFile());

        publisher.publish(publishMetaData);
    } catch (IOException e) {
        throw new UncheckedIOException(e);
    }
}
 
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:22,代码来源:DependencyResolverIvyPublisher.java

示例6: publish

import org.apache.ivy.core.module.descriptor.Artifact; //导入依赖的package包/类
public void publish(ModuleVersionPublishMetaData moduleVersion) throws IOException {
    boolean successfullyPublished = false;
    try {
        ModuleVersionIdentifier id = moduleVersion.getId();
        ModuleRevisionId ivyId = IvyUtil.createModuleRevisionId(id.getGroup(), id.getName(), id.getVersion());
        resolver.beginPublishTransaction(ivyId, true);
        for (ModuleVersionArtifactPublishMetaData artifactMetaData : moduleVersion.getArtifacts()) {
            Artifact artifact = artifactMetaData.toIvyArtifact();
            File artifactFile = artifactMetaData.getFile();
            resolver.publish(artifact, artifactFile, true);
        }
        resolver.commitPublishTransaction();
        successfullyPublished = true;
    } finally {
        if (!successfullyPublished) {
            resolver.abortPublishTransaction();
        }
    }
}
 
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:20,代码来源:IvyResolverBackedModuleVersionPublisher.java

示例7: createIvyArtifact

import org.apache.ivy.core.module.descriptor.Artifact; //导入依赖的package包/类
public Artifact createIvyArtifact(PublishArtifact publishArtifact, ModuleRevisionId moduleRevisionId) {
    Map<String, String> extraAttributes = new HashMap<String, String>();
    if (GUtil.isTrue(publishArtifact.getClassifier())) {
        extraAttributes.put(Dependency.CLASSIFIER, publishArtifact.getClassifier());
    }
    String name = publishArtifact.getName();
    if (!GUtil.isTrue(name)) {
        name = moduleRevisionId.getName();
    }
    return new DefaultArtifact(
            moduleRevisionId,
            publishArtifact.getDate(),
            name,
            publishArtifact.getType(),
            publishArtifact.getExtension(),
            extraAttributes);
}
 
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:18,代码来源:DefaultConfigurationsToArtifactsConverter.java

示例8: download

import org.apache.ivy.core.module.descriptor.Artifact; //导入依赖的package包/类
public EnhancedArtifactDownloadReport download(Artifact artifact, ArtifactResourceResolver resourceResolver, ResourceDownloader resourceDownloader, CacheDownloadOptions options) {
    ResolvedResource resolvedResource = resourceResolver.resolve(artifact);
    long start = System.currentTimeMillis();
    EnhancedArtifactDownloadReport report = new EnhancedArtifactDownloadReport(artifact);
    if (resolvedResource == null) {
        report.setDownloadStatus(DownloadStatus.FAILED);
        report.setDownloadDetails(ArtifactDownloadReport.MISSING_ARTIFACT);
        report.setDownloadTimeMillis(System.currentTimeMillis() - start);
        return report;
    }
    assert resolvedResource.getResource().isLocal();
    File file = new File(resolvedResource.getResource().getName());
    assert file.isFile();

    ArtifactOrigin origin = new ArtifactOrigin(artifact, true, file.getAbsolutePath());
    report.setDownloadStatus(DownloadStatus.NO);
    report.setArtifactOrigin(origin);
    report.setSize(file.length());
    report.setLocalFile(file);
    return report;
}
 
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:22,代码来源:LocalFileRepositoryCacheManager.java

示例9: cacheModuleDescriptor

import org.apache.ivy.core.module.descriptor.Artifact; //导入依赖的package包/类
public ResolvedModuleRevision cacheModuleDescriptor(DependencyResolver resolver, ResolvedResource resolvedResource, DependencyDescriptor dd, Artifact moduleArtifact, ResourceDownloader downloader, CacheMetadataOptions options) throws ParseException {
    if (!moduleArtifact.isMetadata()) {
        return null;
    }

    assert resolvedResource.getResource().isLocal();
    File file = new File(resolvedResource.getResource().getName());
    assert file.isFile();

    ArtifactOrigin origin = new ArtifactOrigin(moduleArtifact, true, file.getAbsolutePath());
    MetadataArtifactDownloadReport report = new MetadataArtifactDownloadReport(moduleArtifact);
    report.setDownloadStatus(DownloadStatus.NO);
    report.setArtifactOrigin(origin);
    report.setSize(file.length());
    report.setLocalFile(file);
    report.setSearched(false);
    report.setOriginalLocalFile(file);

    ModuleDescriptor descriptor = parseModuleDescriptor(resolver, moduleArtifact, options, file, resolvedResource.getResource());
    return new ResolvedModuleRevision(resolver, resolver, descriptor, report);
}
 
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:22,代码来源:LocalFileRepositoryCacheManager.java

示例10: resolveArtifact

import org.apache.ivy.core.module.descriptor.Artifact; //导入依赖的package包/类
public void resolveArtifact(ComponentArtifactMetaData artifact, ModuleSource moduleSource, BuildableArtifactResolveResult result) {
    Artifact ivyArtifact = ((ModuleVersionArtifactMetaData) artifact).toIvyArtifact();
    ArtifactDownloadReport artifactDownloadReport = resolver.download(new Artifact[]{ivyArtifact}, downloadOptions).getArtifactReport(ivyArtifact);
    if (downloadFailed(artifactDownloadReport)) {
        if (artifactDownloadReport instanceof EnhancedArtifactDownloadReport) {
            EnhancedArtifactDownloadReport enhancedReport = (EnhancedArtifactDownloadReport) artifactDownloadReport;
            result.failed(new ArtifactResolveException(artifact.getId(), enhancedReport.getFailure()));
        } else {
            result.failed(new ArtifactResolveException(artifact.getId(), artifactDownloadReport.getDownloadDetails()));
        }
        return;
    }

    File localFile = artifactDownloadReport.getLocalFile();
    if (localFile != null) {
        result.resolved(localFile);
    } else {
        result.notFound(artifact.getId());
    }
}
 
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:21,代码来源:IvyDependencyResolverAdapter.java

示例11: doGetCandidateArtifacts

import org.apache.ivy.core.module.descriptor.Artifact; //导入依赖的package包/类
private Set<ModuleVersionArtifactMetaData> doGetCandidateArtifacts(ModuleVersionMetaData module, Class<? extends SoftwareArtifact> artifactType) {
    if (artifactType == IvyDescriptorArtifact.class) {
        Artifact metadataArtifact = module.getDescriptor().getMetadataArtifact();
        return ImmutableSet.of(module.artifact(metadataArtifact));
    }

    if (artifactType == JvmLibraryJavadocArtifact.class) {
        return createArtifactMetaData(module, "javadoc", "javadoc");
    }

    if (artifactType == JvmLibrarySourcesArtifact.class) {
        return createArtifactMetaData(module, "source", "sources");
    }

    throw new IllegalArgumentException(String.format("Cannot find artifacts of type %s in %s", artifactType.getName(), module));
}
 
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:17,代码来源:IvyDependencyResolverAdapter.java

示例12: publish

import org.apache.ivy.core.module.descriptor.Artifact; //导入依赖的package包/类
public void publish(IvyNormalizedPublication publication, PublicationAwareRepository repository) {
    ModuleVersionPublisher publisher = repository.createPublisher();
    IvyPublicationIdentity projectIdentity = publication.getProjectIdentity();
    ModuleRevisionId moduleRevisionId = IvyUtil.createModuleRevisionId(projectIdentity.getOrganisation(), projectIdentity.getModule(), projectIdentity.getRevision());
    ModuleVersionIdentifier moduleVersionIdentifier = DefaultModuleVersionIdentifier.newId(moduleRevisionId);
    DefaultModuleVersionPublishMetaData publishMetaData = new DefaultModuleVersionPublishMetaData(moduleVersionIdentifier);

    try {
        for (IvyArtifact publishArtifact : publication.getArtifacts()) {
            Artifact ivyArtifact = createIvyArtifact(publishArtifact, moduleRevisionId);
            publishMetaData.addArtifact(ivyArtifact, publishArtifact.getFile());
        }

        Artifact artifact = DefaultArtifact.newIvyArtifact(moduleRevisionId, null);
        publishMetaData.addArtifact(artifact, publication.getDescriptorFile());

        publisher.publish(publishMetaData);
    } catch (IOException e) {
        throw new UncheckedIOException(e);
    }
}
 
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:22,代码来源:DependencyResolverIvyPublisher.java

示例13: populateArtifactsFromDescriptor

import org.apache.ivy.core.module.descriptor.Artifact; //导入依赖的package包/类
private void populateArtifactsFromDescriptor() {
    Map<Artifact, ModuleComponentArtifactMetaData> artifactToMetaData = Maps.newLinkedHashMap();
    for (Artifact descriptorArtifact : getDescriptor().getAllArtifacts()) {
        IvyArtifactName artifactName = DefaultIvyArtifactName.forIvyArtifact(descriptorArtifact);
        ModuleComponentArtifactMetaData artifact = new DefaultModuleComponentArtifactMetaData(getComponentId(), artifactName);
        artifactToMetaData.put(descriptorArtifact, artifact);
    }

    this.artifactsByConfig = LinkedHashMultimap.create();
    for (String configuration : getDescriptor().getConfigurationsNames()) {
        Artifact[] configArtifacts = getDescriptor().getArtifacts(configuration);
        for (Artifact configArtifact : configArtifacts) {
            artifactsByConfig.put(configuration, artifactToMetaData.get(configArtifact));
        }
    }
}
 
开发者ID:dhakehurst,项目名称:net.akehurst.build.gradle,代码行数:17,代码来源:AbstractModuleComponentResolveMetaData.java

示例14: testPublishWithOverwrite

import org.apache.ivy.core.module.descriptor.Artifact; //导入依赖的package包/类
/**
 * Test a simple artifact publish, with overwrite set to true.
 *
 * @throws IOException if something goes wrong
 */
@Test
public void testPublishWithOverwrite() throws IOException {
    // we expect the overwrite settings to be passed through the event listeners and into the
    // publisher.
    this.expectedOverwrite = true;

    // set overwrite to true. InstrumentedResolver will verify that the correct argument value
    // was provided.
    publishOptions.setOverwrite(true);
    Collection<Artifact> missing = publishEngine.publish(publishModule.getModuleRevisionId(),
        publishSources, "default", publishOptions);
    assertEquals("no missing artifacts", 0, missing.size());

    // if all tests passed, all of our counter variables should have been updated.
    assertEquals("pre-publish trigger fired and passed all tests", 2, preTriggers);
    assertEquals("post-publish trigger fired and passed all tests", 2, postTriggers);
    assertEquals("resolver received a publish() call, and passed all tests", 2, publications);
    assertEquals("all expected artifacts have been published", 0, expectedPublications.size());
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:25,代码来源:PublishEventsTest.java

示例15: testSimple

import org.apache.ivy.core.module.descriptor.Artifact; //导入依赖的package包/类
@Test
public void testSimple() throws Exception {
    ModuleDescriptor md = PomModuleDescriptorParser.getInstance().parseDescriptor(settings,
        getClass().getResource("test-simple.pom"), false);
    assertNotNull(md);

    ModuleRevisionId mrid = ModuleRevisionId.newInstance("org.apache", "test", "1.0");
    assertEquals(mrid, md.getModuleRevisionId());

    assertNotNull(md.getConfigurations());
    assertEquals(Arrays.asList(PomModuleDescriptorBuilder.MAVEN2_CONFIGURATIONS),
        Arrays.asList(md.getConfigurations()));

    Artifact[] artifact = md.getArtifacts("master");
    assertEquals(1, artifact.length);
    assertEquals(mrid, artifact[0].getModuleRevisionId());
    assertEquals("test", artifact[0].getName());
    assertEquals("jar", artifact[0].getExt());
    assertEquals("jar", artifact[0].getType());
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:21,代码来源:PomModuleDescriptorParserTest.java


注:本文中的org.apache.ivy.core.module.descriptor.Artifact类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。