Java Code Examples for org.apache.maven.settings.Profile#getRepositories()
The following examples show how to use
org.apache.maven.settings.Profile#getRepositories() .
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: DependencyResolver.java From spring-init with Apache License 2.0 | 5 votes |
private Collection<? extends ArtifactRepository> mavenRepositories( MavenSettings settings) { List<ArtifactRepository> list = new ArrayList<>(); for (Profile profile : settings.getActiveProfiles()) { for (Repository repository : profile.getRepositories()) { addRepositoryIfMissing(list, repository.getId(), repository.getUrl(), repository.getReleases() != null ? repository.getReleases().isEnabled() : true, repository.getSnapshots() != null ? repository.getSnapshots().isEnabled() : false); } } return list; }
Example 2
Source File: DependencyResolver.java From spring-cloud-function with Apache License 2.0 | 5 votes |
private Collection<? extends ArtifactRepository> mavenRepositories( MavenSettings settings) { List<ArtifactRepository> list = new ArrayList<>(); for (Profile profile : settings.getActiveProfiles()) { for (Repository repository : profile.getRepositories()) { addRepositoryIfMissing(list, repository.getId(), repository.getUrl(), repository.getReleases() != null ? repository.getReleases().isEnabled() : true, repository.getSnapshots() != null ? repository.getSnapshots().isEnabled() : false); } } return list; }
Example 3
Source File: MavenLocationExpander.java From pom-manipulation-ext with Apache License 2.0 | 4 votes |
private void addSettingsProfileRepositoriesTo( final Set<Location> locs, final Settings settings, final List<String> activeProfiles, final MirrorSelector mirrorSelector ) throws MalformedURLException { if ( settings != null ) { final Map<String, Profile> profiles = settings.getProfilesAsMap(); if ( profiles != null && activeProfiles != null && !activeProfiles.isEmpty() ) { final LinkedHashSet<String> active = new LinkedHashSet<>( activeProfiles ); final List<String> settingsActiveProfiles = settings.getActiveProfiles(); if ( settingsActiveProfiles != null && !settingsActiveProfiles.isEmpty() ) { active.addAll( settingsActiveProfiles ); } for ( final String profileId : active ) { final Profile profile = profiles.get( profileId ); if ( profile != null ) { final List<Repository> repositories = profile.getRepositories(); if ( repositories != null ) { final List<Mirror> mirrors = settings.getMirrors(); final ArtifactRepositoryLayout layout = new DefaultRepositoryLayout(); for ( final Repository repo : repositories ) { String id = repo.getId(); String url = repo.getUrl(); if ( mirrors != null ) { final ArtifactRepositoryPolicy snapshots = convertPolicy( repo.getSnapshots() ); final ArtifactRepositoryPolicy releases = convertPolicy( repo.getReleases() ); final MavenArtifactRepository arepo = new MavenArtifactRepository( id, url, layout, snapshots, releases ); final Mirror mirror = mirrorSelector == null ? null : mirrorSelector.getMirror( arepo, mirrors ); if ( mirror != null ) { id = mirror.getId(); url = mirror.getUrl(); } SimpleHttpLocation addition = new SimpleHttpLocation( id, url, snapshots.isEnabled(), releases.isEnabled(), true, false, null ); addition.setAttribute(Location.CONNECTION_TIMEOUT_SECONDS, 60); locs.add (addition); } } } } } } } }