public void run() { try { publish(); } catch (Exception e) { throw new PublishException(String.format("Failed to publish publication '%s' to repository '%s'", publication.getName(), repository), e); } }
@Override public void publish(final Iterable<? extends PublicationAwareRepository> repositories, final Module module, final Configuration configuration, final File descriptor) throws PublishException { ivyContextManager.withIvy(new Action<Ivy>() { @Override public void execute(Ivy ivy) { delegate.publish(repositories, module, configuration, descriptor); } }); }
private boolean checkArtifactFileExists(IvyModuleArtifactPublishMetadata artifact) { File artifactFile = artifact.getFile(); if (artifactFile.exists()) { return true; } if (!isSigningArtifact(artifact.getArtifactName())) { throw new PublishException(String.format("Cannot publish artifact '%s' (%s) as it does not exist.", artifact.getId(), artifactFile)); } return false; }
@TaskAction protected void upload() { getLogger().info("Publishing configuration: " + configuration); Module module = ((ConfigurationInternal) configuration).getModule(); ArtifactPublisher artifactPublisher = getPublicationServices().createArtifactPublisher(); File descriptorDestination = isUploadDescriptor() ? getDescriptorDestination() : null; List<PublicationAwareRepository> publishRepositories = collect(getRepositories(), Transformers.cast(PublicationAwareRepository.class)); try { artifactPublisher.publish(publishRepositories, module, configuration, descriptorDestination); } catch (Exception e) { throw new PublishException(String.format("Could not publish configuration '%s'", configuration.getName()), e); } }
public void run() { try { publish(); } catch (Exception e) { throw new PublishException(String.format("Failed to publish publication '%s' to repository '%s'", publication.getName(), repository.getName()), e); } }
private boolean checkArtifactFileExists(IvyModuleArtifactPublishMetaData artifact) { File artifactFile = artifact.getFile(); if (artifactFile.exists()) { return true; } if (!isSigningArtifact(artifact.getArtifactName())) { throw new PublishException(String.format("Cannot publish artifact '%s' (%s) as it does not exist.", artifact.getId(), artifactFile)); } return false; }
public void publish(final Iterable<? extends PublicationAwareRepository> repositories, final ModuleInternal module, final Configuration configuration, final File descriptor) throws PublishException { ivyContextManager.withIvy(new Action<Ivy>() { public void execute(Ivy ivy) { Set<Configuration> allConfigurations = configuration.getAll(); Set<Configuration> configurationsToPublish = configuration.getHierarchy(); MutableLocalComponentMetaData componentMetaData = publishLocalComponentFactory.convert(allConfigurations, module); if (descriptor != null) { ModuleDescriptor moduleDescriptor = componentMetaData.getModuleDescriptor(); ivyModuleDescriptorWriter.write(moduleDescriptor, descriptor); } // Need to convert a second time, to determine which artifacts to publish (and yes, this isn't a great way to do things...) componentMetaData = publishLocalComponentFactory.convert(configurationsToPublish, module); BuildableIvyModulePublishMetaData publishMetaData = componentMetaData.toPublishMetaData(); if (descriptor != null) { Artifact artifact = MDArtifact.newIvyArtifact(componentMetaData.getModuleDescriptor()); publishMetaData.addArtifact(artifact, descriptor); } List<ModuleVersionPublisher> publishResolvers = new ArrayList<ModuleVersionPublisher>(); for (PublicationAwareRepository repository : repositories) { ModuleVersionPublisher publisher = repository.createPublisher(); publishResolvers.add(publisher); } dependencyPublisher.publish(publishResolvers, publishMetaData); } }); }
@TaskAction protected void upload() { getLogger().info("Publishing configuration: " + configuration); ModuleInternal module = ((ConfigurationInternal) configuration).getModule(); ArtifactPublisher artifactPublisher = getPublicationServices().createArtifactPublisher(); File descriptorDestination = isUploadDescriptor() ? getDescriptorDestination() : null; List<PublicationAwareRepository> publishRepositories = collect(getRepositories(), Transformers.cast(PublicationAwareRepository.class)); try { artifactPublisher.publish(publishRepositories, module, configuration, descriptorDestination); } catch (Exception e) { throw new PublishException(String.format("Could not publish configuration '%s'", configuration.getName()), e); } }
public void publish(final Iterable<? extends PublicationAwareRepository> repositories, final ModuleInternal module, final Configuration configuration, final File descriptor) throws PublishException { ivyContextManager.withIvy(new Action<Ivy>() { public void execute(Ivy ivy) { Set<Configuration> allConfigurations = configuration.getAll(); Set<Configuration> configurationsToPublish = configuration.getHierarchy(); MutableLocalComponentMetaData componentMetaData = publishLocalComponentFactory.convert(allConfigurations, module); if (descriptor != null) { ModuleDescriptor moduleDescriptor = componentMetaData.getModuleDescriptor(); ivyModuleDescriptorWriter.write(moduleDescriptor, descriptor); } // Need to convert a second time, to determine which artifacts to publish (and yes, this isn't a great way to do things...) componentMetaData = publishLocalComponentFactory.convert(configurationsToPublish, module); BuildableModuleVersionPublishMetaData publishMetaData = componentMetaData.toPublishMetaData(); if (descriptor != null) { Artifact artifact = MDArtifact.newIvyArtifact(componentMetaData.getModuleDescriptor()); publishMetaData.addArtifact(artifact, descriptor); } List<ModuleVersionPublisher> publishResolvers = new ArrayList<ModuleVersionPublisher>(); for (PublicationAwareRepository repository : repositories) { ModuleVersionPublisher publisher = repository.createPublisher(); publisher.setSettings(ivy.getSettings()); publishResolvers.add(publisher); } dependencyPublisher.publish(publishResolvers, publishMetaData); } }); }
@TaskAction protected void upload() { getLogger().info("Publishing configuration: " + configuration); ModuleInternal module = ((ConfigurationInternal) configuration).getModule(); ArtifactPublisher artifactPublisher = publicationServices.createArtifactPublisher(); File descriptorDestination = isUploadDescriptor() ? getDescriptorDestination() : null; List<PublicationAwareRepository> publishRepositories = collect(repositories, Transformers.cast(PublicationAwareRepository.class)); try { artifactPublisher.publish(publishRepositories, module, configuration, descriptorDestination); } catch (Exception e) { throw new PublishException(String.format("Could not publish configuration '%s'", configuration.getName()), e); } }
private void deploy( PublishArtifact gradleArtifact, Set<? extends ModuleDependency> dependencies ) { DeploymentRequest request = new DeploymentRequest(); Artifact publishArtifact = getPublishArtifact( getProject(), gradleArtifact ); publishArtifact = publishArtifact.setPath( gradleArtifact.getFile().toPath() ); request.setArtifact( publishArtifact ); if ( !Files.exists( publishArtifact.getPath() ) ) { return; } if ( gradleArtifact.getType() != null ) { request.addProperty( "type", gradleArtifact.getType() ); } for ( ModuleDependency dependency : dependencies ) { List<Artifact> dependencyArtifacts = getDependencyArtifacts( dependency ); List<Artifact> exclusionArtifacts = getExclusionArtifacts( dependency ); for ( Artifact dependencyArtifact : dependencyArtifacts ) { request.addDependency( dependencyArtifact, exclusionArtifacts ); } } DeploymentResult result; // prevent parallel access to installation plan synchronized ( XMvnInstallTask.class ) { result = getDeployer().deploy( request ); } if ( result.getException() != null ) { throw new PublishException( "XMVn installation failed", result.getException() ); } }
void publish(Iterable<? extends PublicationAwareRepository> repositories, Module module, Configuration configuration, File descriptor) throws PublishException;
void publish(Iterable<? extends PublicationAwareRepository> repositories, ModuleInternal module, Configuration configuration, File descriptor) throws PublishException;