Java Code Examples for org.apache.ivy.core.module.descriptor.DefaultArtifact#newIvyArtifact()

The following examples show how to use org.apache.ivy.core.module.descriptor.DefaultArtifact#newIvyArtifact() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DependencyResolverIvyPublisher.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
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);
    }
}
 
Example 2
Source File: DependencyResolverIvyPublisher.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
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);
    }
}
 
Example 3
Source File: DependencyResolverIvyPublisher.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
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);
    }
}
 
Example 4
Source File: DependencyResolverIvyPublisher.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
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);
    }
}
 
Example 5
Source File: IvyNode.java    From ant-ivy with Apache License 2.0 5 votes vote down vote up
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 ArrayDeque<IvyNode>());
        return exclude != null && exclude;
    }
    return callers.doesCallersExclude(rootModuleConf, a);
}
 
Example 6
Source File: DefaultRepositoryCacheManager.java    From ant-ivy with Apache License 2.0 5 votes vote down vote up
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);
}
 
Example 7
Source File: OSGiManifestParser.java    From ant-ivy with Apache License 2.0 4 votes vote down vote up
public Artifact getMetadataArtifact(ModuleRevisionId mrid, Resource res) {
    return DefaultArtifact.newIvyArtifact(mrid, new Date(res.getLastModified()));
}
 
Example 8
Source File: AbstractModuleDescriptorParser.java    From ant-ivy with Apache License 2.0 4 votes vote down vote up
public Artifact getMetadataArtifact(ModuleRevisionId mrid, Resource res) {
    return DefaultArtifact.newIvyArtifact(mrid, new Date(res.getLastModified()));
}