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


Java DefaultArtifact类代码示例

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


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

示例1: publish

import org.apache.ivy.core.module.descriptor.DefaultArtifact; //导入依赖的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

示例2: createIvyArtifact

import org.apache.ivy.core.module.descriptor.DefaultArtifact; //导入依赖的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

示例3: publish

import org.apache.ivy.core.module.descriptor.DefaultArtifact; //导入依赖的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

示例4: analyse

import org.apache.ivy.core.module.descriptor.DefaultArtifact; //导入依赖的package包/类
public void analyse(String pattern, DependencyAnalyser depAnalyser) {
    JarModuleFinder finder = new JarModuleFinder(pattern);
    ModuleDescriptor[] mds = depAnalyser.analyze(finder.findJarModules());
    Message.info("found " + mds.length + " modules");
    for (ModuleDescriptor md : mds) {
        File ivyFile = new File(IvyPatternHelper.substitute(
                pattern,
                DefaultArtifact.newIvyArtifact(md.getModuleRevisionId(),
                        md.getPublicationDate())));
        try {
            Message.info("generating " + ivyFile);
            XmlModuleDescriptorWriter.write(md, ivyFile);
        } catch (IOException e) {
            Message.debug(e);
        }
    }
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:18,代码来源:RepositoryAnalyser.java

示例5: findIvyFileRef

import org.apache.ivy.core.module.descriptor.DefaultArtifact; //导入依赖的package包/类
@Override
public ResolvedResource findIvyFileRef(DependencyDescriptor dd, ResolveData data) {
    if (!isM2compatible() || !isUsepoms()) {
        return null;
    }
    ModuleRevisionId mrid = dd.getDependencyRevisionId();
    mrid = convertM2IdForResourceSearch(mrid);
    final String revision = dd.getDependencyRevisionId().getRevision();
    final MavenTimedSnapshotVersionMatcher.MavenSnapshotRevision snapshotRevision = MavenTimedSnapshotVersionMatcher.computeIfSnapshot(revision);
    if (snapshotRevision != null) {
        final ResolvedResource rres = findSnapshotDescriptor(dd, data, mrid, snapshotRevision);
        if (rres != null) {
            return rres;
        }
    }
    return findResourceUsingPatterns(mrid, getIvyPatterns(),
            DefaultArtifact.newPomArtifact(mrid, data.getDate()), getRMDParser(dd, data),
            data.getDate());
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:20,代码来源:IBiblioResolver.java

示例6: putSignature

import org.apache.ivy.core.module.descriptor.DefaultArtifact; //导入依赖的package包/类
protected void putSignature(Artifact artifact, File src, String dest, boolean overwrite)
        throws IOException {
    SignatureGenerator gen = getSettings().getSignatureGenerator(signerName);
    if (gen == null) {
        throw new IllegalArgumentException("Couldn't sign the artifacts! "
                + "Unknown signer name: '" + signerName + "'");
    }

    File tempFile = File.createTempFile("ivytemp", gen.getExtension());

    try {
        gen.sign(src, tempFile);
        repository.put(
            DefaultArtifact.cloneWithAnotherTypeAndExt(artifact, gen.getExtension(),
                artifact.getExt() + "." + gen.getExtension()), tempFile,
            dest + "." + gen.getExtension(), overwrite);
    } finally {
        tempFile.delete();
    }
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:21,代码来源:RepositoryResolver.java

示例7: testAbortTransaction

import org.apache.ivy.core.module.descriptor.DefaultArtifact; //导入依赖的package包/类
@Test
public void testAbortTransaction() throws Exception {
    FileSystemResolver resolver = new FileSystemResolver();
    resolver.setName("test");
    resolver.setSettings(settings);

    resolver.addIvyPattern(settings.getBaseDir()
            + "/test/repositories/1/[organisation]/[module]/[revision]/[artifact].[ext]");
    resolver.addArtifactPattern(settings.getBaseDir()
            + "/test/repositories/1/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]");

    ModuleRevisionId mrid = ModuleRevisionId.newInstance("myorg", "mymodule", "myrevision");
    Artifact ivyArtifact = new DefaultArtifact(mrid, new Date(), "ivy", "ivy", "xml");
    Artifact artifact = new DefaultArtifact(mrid, new Date(), "myartifact", "mytype",
            "myext");
    File src = new File("test/repositories/ivysettings.xml");
    resolver.beginPublishTransaction(mrid, false);
    resolver.publish(ivyArtifact, src, false);
    resolver.publish(artifact, src, false);
    resolver.abortPublishTransaction();

    assertFalse(new File("test/repositories/1/myorg/mymodule/myrevision/ivy.xml").exists());
    assertFalse(new File(
            "test/repositories/1/myorg/mymodule/myrevision/myartifact-myrevision.myext")
            .exists());
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:27,代码来源:FileSystemResolverTest.java

示例8: testUnsupportedTransaction

import org.apache.ivy.core.module.descriptor.DefaultArtifact; //导入依赖的package包/类
/**
 * Publishing with transaction=true and an unsupported pattern must fail.
 *
 * @throws Exception if something goes wrong
 */
@Test
public void testUnsupportedTransaction() throws Exception {
    expExc.expect(IllegalStateException.class);
    expExc.expectMessage("transactional");

    FileSystemResolver resolver = new FileSystemResolver();
    resolver.setName("test");
    resolver.setSettings(settings);
    resolver.setTransactional("true");

    resolver.addArtifactPattern(
            // this pattern is not supported for transaction publish
            settings.getBaseDir()
                    + "/test/repositories/1/[organisation]/[module]/[artifact]-[revision].[ext]");

    ModuleRevisionId mrid = ModuleRevisionId.newInstance("myorg", "mymodule", "myrevision");
    Artifact artifact = new DefaultArtifact(mrid, new Date(), "myartifact", "mytype",
            "myext");
    File src = new File("test/repositories/ivysettings.xml");

    resolver.beginPublishTransaction(mrid, false);
    resolver.publish(artifact, src, false);
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:29,代码来源:FileSystemResolverTest.java

示例9: testUnsupportedTransaction3

import org.apache.ivy.core.module.descriptor.DefaultArtifact; //导入依赖的package包/类
/**
 * Publishing with transaction=true and overwrite mode must fail.
 *
 * @throws Exception if something goes wrong
 */
@Test
public void testUnsupportedTransaction3() throws Exception {
    expExc.expect(IllegalStateException.class);
    expExc.expectMessage("transactional");

    FileSystemResolver resolver = new FileSystemResolver();
    resolver.setName("test");
    resolver.setSettings(settings);
    resolver.setTransactional("true");

    resolver.addArtifactPattern(settings.getBaseDir()
            + "/test/repositories/1/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]");

    ModuleRevisionId mrid = ModuleRevisionId.newInstance("myorg", "mymodule", "myrevision");
    Artifact artifact = new DefaultArtifact(mrid, new Date(), "myartifact", "mytype",
            "myext");
    File src = new File("test/repositories/ivysettings.xml");

    // overwrite transaction not supported
    resolver.beginPublishTransaction(mrid, true);
    resolver.publish(artifact, src, true);
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:28,代码来源:FileSystemResolverTest.java

示例10: publish

import org.apache.ivy.core.module.descriptor.DefaultArtifact; //导入依赖的package包/类
public void publish(IvyModulePublishMetadata moduleVersion) {
    for (IvyModuleArtifactPublishMetadata artifactMetadata : moduleVersion.getArtifacts()) {
        IvyArtifactName artifact = artifactMetadata.getArtifactName();
        ModuleRevisionId moduleRevisionId = IvyUtil.createModuleRevisionId(artifactMetadata.getId().getComponentIdentifier());
        Map<String, String> attributes = Collections.singletonMap("classifier", artifact.getClassifier());
        Artifact ivyArtifact = new DefaultArtifact(moduleRevisionId, null, artifact.getName(), artifact.getType(), artifact.getExtension(), attributes);
        collectArtifact(ivyArtifact, artifactMetadata.getFile());
    }
    publish();
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:11,代码来源:AbstractMavenResolver.java

示例11: ivy2aether

import org.apache.ivy.core.module.descriptor.DefaultArtifact; //导入依赖的package包/类
private static org.fedoraproject.xmvn.artifact.Artifact ivy2aether( ModuleRevisionId revision, String extension )
{
    String groupId = revision.getOrganisation();
    String artifactId = revision.getName();
    String classifier = revision.getExtraAttribute( "classifier" );
    String version = revision.getRevision();

    return new org.fedoraproject.xmvn.artifact.DefaultArtifact( groupId, artifactId, extension, classifier,
                                                                version );
}
 
开发者ID:fedora-java,项目名称:xmvn,代码行数:11,代码来源:IvyResolver.java

示例12: findIvyFileRef

import org.apache.ivy.core.module.descriptor.DefaultArtifact; //导入依赖的package包/类
@Override
public ResolvedResource findIvyFileRef( DependencyDescriptor depDescriptor, ResolveData data )
{
    Artifact artifact = DefaultArtifact.newIvyArtifact( depDescriptor.getDependencyRevisionId(), null );

    ResolutionRequest request = new ResolutionRequest();
    request.setArtifact( ivy2aether( artifact.getModuleRevisionId(), "pom" ) );
    ResolutionResult result = getResolver().resolve( request );
    Path pomPath = result.getArtifactPath();
    if ( pomPath == null )
        return null;

    Resource fileResource = new FileResource( new FileRepository(), pomPath.toFile() );
    return new ResolvedResource( fileResource, resolvedVersion( result ) );
}
 
开发者ID:fedora-java,项目名称:xmvn,代码行数:16,代码来源:IvyResolver.java

示例13: toPublishedArtifact

import org.apache.ivy.core.module.descriptor.DefaultArtifact; //导入依赖的package包/类
static Artifact toPublishedArtifact(JkIvyPublication.Artifact artifact,
        ModuleRevisionId moduleId, Instant date) {
    final String artifactName = JkUtilsString.isBlank(artifact.name) ? moduleId.getName()
            : artifact.name;
    final String extension = JkUtilsObject.firstNonNull(artifact.extension, "");
    final String type = JkUtilsObject.firstNonNull(artifact.type, extension);
    return new DefaultArtifact(moduleId, new Date(date.toEpochMilli()), artifactName, type, extension);
}
 
开发者ID:jerkar,项目名称:jerkar,代码行数:9,代码来源:IvyTranslations.java

示例14: toPublishedMavenArtifact

import org.apache.ivy.core.module.descriptor.DefaultArtifact; //导入依赖的package包/类
private static Artifact toPublishedMavenArtifact(Path artifact, String artifactName,
                                                 String classifier, ModuleRevisionId moduleId, Instant date) {
    final String extension = JkUtilsString.substringAfterLast(artifact.getFileName().toString(), ".");
    final Map<String, String> extraMap;
    if (classifier == null) {
        extraMap = new HashMap<>();
    } else {
        extraMap = JkUtilsIterable.mapOf(EXTRA_PREFIX + ":classifier", classifier);
    }
    return new DefaultArtifact(moduleId, new Date(date.toEpochMilli()), artifactName, extension, extension, extraMap);
}
 
开发者ID:jerkar,项目名称:jerkar,代码行数:12,代码来源:IvyTranslations.java

示例15: createIvyArtifact

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


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