org.gradle.api.artifacts.repositories.MavenArtifactRepository Java Examples
The following examples show how to use
org.gradle.api.artifacts.repositories.MavenArtifactRepository.
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: PluginResolutionServiceResolver.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 6 votes |
private ClassPath resolvePluginDependencies(final PluginUseMetaData metadata) { DependencyResolutionServices resolution = dependencyResolutionServicesFactory.create(); RepositoryHandler repositories = resolution.getResolveRepositoryHandler(); final String repoUrl = metadata.implementation.get("repo"); repositories.maven(new Action<MavenArtifactRepository>() { public void execute(MavenArtifactRepository mavenArtifactRepository) { mavenArtifactRepository.setUrl(repoUrl); } }); Dependency dependency = resolution.getDependencyHandler().create(metadata.implementation.get("gav")); ConfigurationContainerInternal configurations = (ConfigurationContainerInternal) resolution.getConfigurationContainer(); ConfigurationInternal configuration = configurations.detachedConfiguration(dependency); try { Set<File> files = configuration.getResolvedConfiguration().getFiles(Specs.satisfyAll()); return new DefaultClassPath(files); } catch (ResolveException e) { throw new DependencyResolutionException("Failed to resolve all plugin dependencies from " + repoUrl, e.getCause()); } }
Example #2
Source File: DefaultRepositoryHandler.java From pushfish-android with BSD 2-Clause "Simplified" License | 6 votes |
public DependencyResolver mavenRepo(Map<String, ?> args, Closure configClosure) { DeprecationLogger.nagUserOfReplacedMethod("RepositoryHandler.mavenRepo()", "maven()"); Map<String, Object> modifiedArgs = new HashMap<String, Object>(args); if (modifiedArgs.containsKey("urls")) { List<?> urls = flattenCollections(modifiedArgs.remove("urls")); if (!urls.isEmpty()) { modifiedArgs.put("url", urls.get(0)); List<?> extraUrls = urls.subList(1, urls.size()); modifiedArgs.put("artifactUrls", extraUrls); } } MavenArtifactRepository repository = repositoryFactory.createMavenRepository(); ConfigureUtil.configureByMap(modifiedArgs, repository); DependencyResolver resolver = repositoryFactory.toResolver(repository); ConfigureUtil.configure(configClosure, resolver); addRepository(repositoryFactory.createResolverBackedRepository(resolver), "mavenRepo"); return resolver; }
Example #3
Source File: MavenPublishPlugin.java From pushfish-android with BSD 2-Clause "Simplified" License | 6 votes |
private void createPublishTasksForEachMavenRepo(CollectionBuilder<Task> tasks, PublishingExtension extension, final Task publishLifecycleTask, final MavenPublicationInternal publication, final String publicationName) { for (final MavenArtifactRepository repository : extension.getRepositories().withType(MavenArtifactRepository.class)) { final String repositoryName = repository.getName(); String publishTaskName = String.format("publish%sPublicationTo%sRepository", capitalize(publicationName), capitalize(repositoryName)); tasks.create(publishTaskName, PublishToMavenRepository.class, new Action<PublishToMavenRepository>() { public void execute(PublishToMavenRepository publishTask) { publishTask.setPublication(publication); publishTask.setRepository(repository); publishTask.setGroup(PublishingPlugin.PUBLISH_TASK_GROUP); publishTask.setDescription(String.format("Publishes Maven publication '%s' to Maven repository '%s'.", publicationName, repositoryName)); //Because dynamic rules are not yet implemented we have to violate input immutability here as an interim step publishLifecycleTask.dependsOn(publishTask); } }); } }
Example #4
Source File: ValidatingMavenPublisher.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
public void publish(MavenNormalizedPublication publication, MavenArtifactRepository artifactRepository) { validateIdentity(publication); validateArtifacts(publication); checkNoDuplicateArtifacts(publication); delegate.publish(publication, artifactRepository); }
Example #5
Source File: PublishToMavenRepository.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
protected void doPublish(final MavenPublicationInternal publication, final MavenArtifactRepository repository) { new PublishOperation(publication, repository) { @Override protected void publish() throws Exception { MavenPublisher antBackedPublisher = new AntTaskBackedMavenPublisher(getLoggingManagerFactory(), getTemporaryDirFactory()); MavenPublisher staticLockingPublisher = new StaticLockingMavenPublisher(antBackedPublisher); MavenPublisher validatingPublisher = new ValidatingMavenPublisher(staticLockingPublisher); validatingPublisher.publish(publication.asNormalisedPublication(), repository); } }.run(); }
Example #6
Source File: PublishToMavenRepositoryHook.java From atlas with Apache License 2.0 | 5 votes |
@TaskAction public void publish() { MavenPublicationInternal publicationInternal = getPublicationInternal(); if (publicationInternal == null) { throw new InvalidUserDataException("The 'publication' property is required"); } MavenArtifactRepository repository = getRepository(); if (repository == null) { throw new InvalidUserDataException("The 'repository' property is required"); } doPublish(publicationInternal, repository); }
Example #7
Source File: BasePlugin.java From javaide with GNU General Public License v3.0 | 5 votes |
final void createAndroidTasks() { // Make sure unit tests set the required fields. checkState(extension.getBuildToolsRevision() != null, "buildToolsVersion is not specified."); checkState(extension.getCompileSdkVersion() != null, "compileSdkVersion is not specified."); ensureTargetSetup(); if (hasCreatedTasks) { return; } hasCreatedTasks = true; extension.disableWrite(); // setup SDK repositories. for (final File file : sdkHandler.getSdkLoader().getRepositories()) { project.getRepositories().maven(new Action<MavenArtifactRepository>() { @Override public void execute(@NonNull MavenArtifactRepository mavenArtifactRepository) { mavenArtifactRepository.setUrl(file.toURI()); } }); } variantManager.createAndroidTasks(); ApiObjectFactory apiObjectFactory = new ApiObjectFactory( androidBuilder, extension, variantFactory, instantiator); for (BaseVariantData variantData : variantManager.getVariantDataList()) { apiObjectFactory.create(variantData); } }
Example #8
Source File: PublishToMavenRepository.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
@TaskAction public void publish() { MavenPublicationInternal publicationInternal = getPublicationInternal(); if (publicationInternal == null) { throw new InvalidUserDataException("The 'publication' property is required"); } MavenArtifactRepository repository = getRepository(); if (repository == null) { throw new InvalidUserDataException("The 'repository' property is required"); } doPublish(publicationInternal, repository); }
Example #9
Source File: AbstractAntTaskBackedMavenPublisher.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
public void publish(MavenNormalizedPublication publication, MavenArtifactRepository artifactRepository) { logger.info("Publishing to repository {}", artifactRepository); T deployTask = createDeployTask(); deployTask.setProject(AntUtil.createProject()); MavenSettingsSupplier mavenSettingsSupplier = new EmptyMavenSettingsSupplier(); mavenSettingsSupplier.supply(deployTask); postConfigure(deployTask, artifactRepository); addPomAndArtifacts(deployTask, publication); execute(deployTask); mavenSettingsSupplier.done(); }
Example #10
Source File: PublishToMavenRepository.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
protected void doPublish(final MavenPublicationInternal publication, final MavenArtifactRepository repository) { new PublishOperation(publication, repository) { @Override protected void publish() throws Exception { MavenPublisher antBackedPublisher = new AntTaskBackedMavenPublisher(getLoggingManagerFactory(), getTemporaryDirFactory()); MavenPublisher staticLockingPublisher = new StaticLockingMavenPublisher(antBackedPublisher); MavenPublisher validatingPublisher = new ValidatingMavenPublisher(staticLockingPublisher); validatingPublisher.publish(publication.asNormalisedPublication(), repository); } }.run(); }
Example #11
Source File: DefaultRepositoryHandler.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
public MavenArtifactRepository mavenCentral(Map<String, ?> args) { Map<String, Object> modifiedArgs = new HashMap<String, Object>(args); if (modifiedArgs.containsKey("urls")) { DeprecationLogger.nagUserOfDeprecated( "The 'urls' property of the RepositoryHandler.mavenCentral() method", "You should use the 'artifactUrls' property to define additional artifact locations" ); List<?> urls = flattenCollections(modifiedArgs.remove("urls")); modifiedArgs.put("artifactUrls", urls); } return addRepository(repositoryFactory.createMavenCentralRepository(), DEFAULT_MAVEN_CENTRAL_REPO_NAME, new ConfigureByMapAction<MavenArtifactRepository>(modifiedArgs)); }
Example #12
Source File: PublishToMavenRepository.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
protected void doPublish(final MavenPublicationInternal publication, final MavenArtifactRepository repository) { new PublishOperation(publication, repository) { @Override protected void publish() throws Exception { MavenPublisher antBackedPublisher = new AntTaskBackedMavenPublisher(loggingManagerFactory, getTemporaryDirFactory()); MavenPublisher staticLockingPublisher = new StaticLockingMavenPublisher(antBackedPublisher); MavenPublisher validatingPublisher = new ValidatingMavenPublisher(staticLockingPublisher); validatingPublisher.publish(publication.asNormalisedPublication(), repository); } }.run(); }
Example #13
Source File: JavaScriptRepositoriesExtension.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
public MavenArtifactRepository gradle(final Action<? super MavenArtifactRepository> action) { return repositories.maven(new Action<MavenArtifactRepository>() { public void execute(MavenArtifactRepository repository) { repository.setName("gradleJs"); repository.setUrl(GRADLE_PUBLIC_JAVASCRIPT_REPO_URL); action.execute(repository); } }); }
Example #14
Source File: GradleArtifactResolvingHelper.java From ARCHIVE-wildfly-swarm with Apache License 2.0 | 5 votes |
public GradleArtifactResolvingHelper(Project project) { this.project = project; this.project.getRepositories().maven(new Action<MavenArtifactRepository>() { @Override public void execute(MavenArtifactRepository repo) { repo.setName("jboss-public"); repo.setUrl("http://repository.jboss.org/nexus/content/groups/public/"); } }); }
Example #15
Source File: AbstractAntTaskBackedMavenPublisher.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
public void publish(MavenNormalizedPublication publication, MavenArtifactRepository artifactRepository) { logger.info("Publishing to repository {}", artifactRepository); T deployTask = createDeployTask(); deployTask.setProject(AntUtil.createProject()); MavenSettingsSupplier mavenSettingsSupplier = new EmptyMavenSettingsSupplier(); mavenSettingsSupplier.supply(deployTask); postConfigure(deployTask, artifactRepository); addPomAndArtifacts(deployTask, publication); execute(deployTask); mavenSettingsSupplier.done(); }
Example #16
Source File: DefaultRepositoryHandler.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
public MavenArtifactRepository mavenCentral(Map<String, ?> args) { Map<String, Object> modifiedArgs = new HashMap<String, Object>(args); if (modifiedArgs.containsKey("urls")) { DeprecationLogger.nagUserOfDeprecated( "The 'urls' property of the RepositoryHandler.mavenCentral() method", "You should use the 'artifactUrls' property to define additional artifact locations" ); List<?> urls = flattenCollections(modifiedArgs.remove("urls")); modifiedArgs.put("artifactUrls", urls); } return addRepository(repositoryFactory.createMavenCentralRepository(), DEFAULT_MAVEN_CENTRAL_REPO_NAME, new ConfigureByMapAction<MavenArtifactRepository>(modifiedArgs)); }
Example #17
Source File: MavenPublishTaskModelRule.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
private void createPublishTasksForEachMavenRepo(TaskContainer tasks, PublishingExtension extension, MavenPublicationInternal publication, String publicationName) { for (MavenArtifactRepository repository : extension.getRepositories().withType(MavenArtifactRepository.class)) { String repositoryName = repository.getName(); String publishTaskName = String.format("publish%sPublicationTo%sRepository", capitalize(publicationName), capitalize(repositoryName)); PublishToMavenRepository publishTask = tasks.create(publishTaskName, PublishToMavenRepository.class); publishTask.setPublication(publication); publishTask.setRepository(repository); publishTask.setGroup(PublishingPlugin.PUBLISH_TASK_GROUP); publishTask.setDescription(String.format("Publishes Maven publication '%s' to Maven repository '%s'.", publicationName, repositoryName)); publishLifecycleTask.dependsOn(publishTask); } }
Example #18
Source File: AbstractAntTaskBackedMavenPublisher.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
public void publish(MavenNormalizedPublication publication, MavenArtifactRepository artifactRepository) { logger.info("Publishing to repository {}", artifactRepository); T deployTask = createDeployTask(); deployTask.setProject(AntUtil.createProject()); MavenSettingsSupplier mavenSettingsSupplier = new EmptyMavenSettingsSupplier(); mavenSettingsSupplier.supply(deployTask); postConfigure(deployTask, artifactRepository); addPomAndArtifacts(deployTask, publication); execute(deployTask); mavenSettingsSupplier.done(); }
Example #19
Source File: PublishToMavenLocal.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
@Override protected void doPublish(final MavenPublicationInternal publication, final MavenArtifactRepository repository) { new PublishOperation(publication, repository) { @Override protected void publish() throws Exception { MavenPublisher antBackedPublisher = new AntTaskBackedMavenLocalPublisher(getLoggingManagerFactory(), getTemporaryDirFactory()); MavenPublisher staticLockingPublisher = new StaticLockingMavenPublisher(antBackedPublisher); MavenPublisher validatingPublisher = new ValidatingMavenPublisher(staticLockingPublisher); validatingPublisher.publish(publication.asNormalisedPublication(), repository); } }.run(); }
Example #20
Source File: StaticLockingMavenPublisher.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
public void publish(MavenNormalizedPublication publication, MavenArtifactRepository artifactRepository) { STATIC_LOCK.lock(); try { delegate.publish(publication, artifactRepository); } finally { STATIC_LOCK.unlock(); } }
Example #21
Source File: JavaScriptRepositoriesExtension.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
public MavenArtifactRepository gradle(final Action<? super MavenArtifactRepository> action) { return repositories.maven(new Action<MavenArtifactRepository>() { public void execute(MavenArtifactRepository repository) { repository.setName("gradleJs"); repository.setUrl(GRADLE_PUBLIC_JAVASCRIPT_REPO_URL); action.execute(repository); } }); }
Example #22
Source File: PublishToMavenLocal.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
@Override public MavenArtifactRepository getRepository() { if (super.getRepository() == null) { // Instantiate the default MavenLocal repository if none has been set explicitly MavenArtifactRepository mavenLocalRepository = getBaseRepositoryFactory().createMavenLocalRepository(); mavenLocalRepository.setName(ArtifactRepositoryContainer.DEFAULT_MAVEN_LOCAL_REPO_NAME); setRepository(mavenLocalRepository); } return super.getRepository(); }
Example #23
Source File: AntTaskBackedMavenPublisher.java From pushfish-android with BSD 2-Clause "Simplified" License | 4 votes |
protected void postConfigure(CustomDeployTask task, MavenArtifactRepository artifactRepository) { addRepository(task, artifactRepository); }
Example #24
Source File: AntTaskBackedMavenPublisher.java From pushfish-android with BSD 2-Clause "Simplified" License | 4 votes |
private void addRepository(CustomDeployTask deployTask, MavenArtifactRepository artifactRepository) { RemoteRepository mavenRepository = new MavenRemoteRepositoryFactory(artifactRepository).create(); deployTask.addRemoteRepository(mavenRepository); }
Example #25
Source File: DefaultBaseRepositoryFactory.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
public MavenArtifactRepository createMavenCentralRepository() { MavenArtifactRepository mavenRepository = createMavenRepository(); mavenRepository.setUrl(RepositoryHandler.MAVEN_CENTRAL_URL); return mavenRepository; }
Example #26
Source File: DefaultRepositoryHandler.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
public MavenArtifactRepository maven(Closure closure) { return maven(new ClosureBackedAction<MavenArtifactRepository>(closure)); }
Example #27
Source File: AntTaskBackedMavenPublisher.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
private void addRepository(CustomDeployTask deployTask, MavenArtifactRepository artifactRepository) { RemoteRepository mavenRepository = new MavenRemoteRepositoryFactory(artifactRepository).create(); deployTask.addRemoteRepository(mavenRepository); }
Example #28
Source File: DefaultRepositoryHandler.java From pushfish-android with BSD 2-Clause "Simplified" License | 4 votes |
public MavenArtifactRepository maven(Action<? super MavenArtifactRepository> action) { return addRepository(repositoryFactory.createMavenRepository(), MAVEN_REPO_DEFAULT_NAME, action); }
Example #29
Source File: AntTaskBackedMavenPublisher.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
protected void postConfigure(CustomDeployTask task, MavenArtifactRepository artifactRepository) { addRepository(task, artifactRepository); }
Example #30
Source File: MavenRemoteRepositoryFactory.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
public MavenRemoteRepositoryFactory(MavenArtifactRepository artifactRepository) { this.artifactRepository = artifactRepository; }