• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java DefaultArtifact类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: createModuleDescriptor

import org.apache.ivy.core.module.descriptor.DefaultArtifact; //导入依赖的package包/类
public MutableModuleVersionMetaData createModuleDescriptor(ModuleRevisionId moduleRevisionId, Set<ModuleDependency> dependencies) {
    DefaultModuleDescriptor moduleDescriptor = new DefaultModuleDescriptor(moduleRevisionId,
            "release", null);
    moduleDescriptor.addConfiguration(new Configuration(Dependency.DEFAULT_CONFIGURATION));
    addDependencyDescriptors(moduleDescriptor, dependencies, dependencyDescriptorFactory);
    moduleDescriptor.addArtifact(Dependency.DEFAULT_CONFIGURATION,
            new DefaultArtifact(moduleRevisionId, null, moduleRevisionId.getName(), "jar", "jar"));
    return new ModuleDescriptorAdapter(moduleDescriptor);
}
 
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:10,代码来源:DefaultClientModuleMetaDataFactory.java


示例17: createWorkspaceArtifacts

import org.apache.ivy.core.module.descriptor.DefaultArtifact; //导入依赖的package包/类
@Override
protected List<Artifact> createWorkspaceArtifacts(ModuleDescriptor md) {
    List<Artifact> res = new ArrayList<>();

    for (WorkspaceArtifact wa : artifacts) {
        String name = wa.name;
        String type = wa.type;
        String ext = wa.ext;
        String path = wa.path;
        if (name == null) {
            name = md.getModuleRevisionId().getName();
        }
        if (type == null) {
            type = "jar";
        }
        if (ext == null) {
            ext = "jar";
        }
        if (path == null) {
            path = "target" + File.separator + "dist" + File.separator + type + "s"
                    + File.separator + name + "." + ext;
        }

        URL url;
        File ivyFile = md2IvyFile.get(md);
        File artifactFile = new File(ivyFile.getParentFile(), path);
        try {
            url = artifactFile.toURI().toURL();
        } catch (MalformedURLException e) {
            throw new RuntimeException("Unsupported file path : " + artifactFile, e);
        }

        res.add(new DefaultArtifact(md.getModuleRevisionId(), new Date(), name, type, ext,
                url, null));
    }

    return res;
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:39,代码来源:AntWorkspaceResolver.java


示例18: isDependencyModuleExcluded

import org.apache.ivy.core.module.descriptor.DefaultArtifact; //导入依赖的package包/类
private boolean isDependencyModuleExcluded(DependencyDescriptor dd, String rootModuleConf,
        ModuleRevisionId dependencyRevisionId, String conf) {
    Artifact a = DefaultArtifact.newIvyArtifact(dependencyRevisionId, null);
    if (isRoot()) {
        // no callers, but maybe some exclude
        Boolean exclude = doesExclude(md, rootModuleConf, new String[] {rootModuleConf}, dd, a,
            new Stack<ModuleRevisionId>());
        return exclude != null && exclude;
    }
    return callers.doesCallersExclude(rootModuleConf, a);
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:12,代码来源:IvyNode.java


示例19: getDefaultMetadataArtifactOrigin

import org.apache.ivy.core.module.descriptor.DefaultArtifact; //导入依赖的package包/类
private ArtifactOrigin getDefaultMetadataArtifactOrigin(ModuleRevisionId mrid) {
    final String location;
    try {
        location = this.getIvyFileInCache(mrid).toURI().toURL().toExternalForm();
    } catch (MalformedURLException e) {
        throw new RuntimeException("Failed to determine artifact origin for " + mrid);
    }
    // it's important to say the origin is not local to make sure it won't ever be used for
    // anything else than original token
    return new ArtifactOrigin(DefaultArtifact.newIvyArtifact(mrid, null), false, location);
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:12,代码来源:DefaultRepositoryCacheManager.java


示例20: toString

import org.apache.ivy.core.module.descriptor.DefaultArtifact; //导入依赖的package包/类
public String toString() {
    if (origin == null) {
        ModuleRevisionId revId = ModuleRevisionId.newInstance(org, moduleName, branch,
            revision, extraModuleAttributes);
        Artifact artifact = new DefaultArtifact(revId, null, artifactName, artifactType,
                artifactExt, extraArtifactAttributes);

        // TODO cache: see how we could know which actual cache manager to use, since this
        // will fail when using a resolver in a chain with a specific cache manager
        RepositoryCacheManager cacheManager = IvyContext.getContext().getSettings()
                .getResolver(revId).getRepositoryCacheManager();

        origin = cacheManager.getSavedArtifactOrigin(artifact);

        if (ArtifactOrigin.isUnknown(origin)) {
            Message.debug("no artifact origin found for " + artifact + " in "
                    + cacheManager);
            return null;
        }
    }

    if (ArtifactOrigin.isUnknown(origin)) {
        return null;
    }

    // we assume that the original filename is the last part of the original file location
    String location = origin.getLocation();
    int lastPathIndex = location.lastIndexOf('/');
    if (lastPathIndex == -1) {
        lastPathIndex = location.lastIndexOf('\\');
    }
    int lastColonIndex = location.lastIndexOf('.');

    return location.substring(lastPathIndex + 1, lastColonIndex);
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:36,代码来源:IvyPatternHelper.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java SimpleEvent类代码示例发布时间:2022-05-22
下一篇:
Java HepProgram类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap