本文整理汇总了Java中org.apache.maven.settings.Repository类的典型用法代码示例。如果您正苦于以下问题:Java Repository类的具体用法?Java Repository怎么用?Java Repository使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Repository类属于org.apache.maven.settings包,在下文中一共展示了Repository类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: addReleaseRepositories
import org.apache.maven.settings.Repository; //导入依赖的package包/类
/**
* Adds a list of release repository configurations to the maven profile object
*
* @param contextUrl System URL
* @param profile Maven profile to append to
* @param repositories Repositories to add to the profile
*/
private void addReleaseRepositories(String contextUrl, Profile profile,
List<MavenSettingsRepository> repositories) {
for (MavenSettingsRepository repository : repositories) {
Repository repoToAdd = new Repository();
repoToAdd.setId(repository.getId());
String repositoryName = repository.getName();
repoToAdd.setName(repositoryName);
repoToAdd.setUrl(contextUrl + repositoryName);
boolean handlesSnapshots = repository.isHandlesSnapshots();
RepositoryPolicy snapshotPolicy = new RepositoryPolicy();
snapshotPolicy.setEnabled(handlesSnapshots);
repoToAdd.setSnapshots(snapshotPolicy);
profile.addRepository(repoToAdd);
}
}
开发者ID:alancnet,项目名称:artifactory,代码行数:25,代码来源:MavenServiceImpl.java
示例2: addPluginRepositories
import org.apache.maven.settings.Repository; //导入依赖的package包/类
/**
* Adds a list of plugin repository configurations to the maven profile object
*
* @param contextUrl System URL
* @param profile Maven profile to append to
* @param repositories Repositories to add to the profile
*/
private void addPluginRepositories(String contextUrl, Profile profile, List<MavenSettingsRepository> repositories) {
for (MavenSettingsRepository repository : repositories) {
Repository repoToAdd = new Repository();
repoToAdd.setId(repository.getId());
String repositoryName = repository.getName();
repoToAdd.setName(repositoryName);
repoToAdd.setUrl(contextUrl + repositoryName);
boolean handlesSnapshots = repository.isHandlesSnapshots();
RepositoryPolicy snapshotPolicy = new RepositoryPolicy();
snapshotPolicy.setEnabled(handlesSnapshots);
repoToAdd.setSnapshots(snapshotPolicy);
profile.addPluginRepository(repoToAdd);
}
}
开发者ID:alancnet,项目名称:artifactory,代码行数:24,代码来源:MavenServiceImpl.java
示例3: convertFromMavenSettingsRepository
import org.apache.maven.settings.Repository; //导入依赖的package包/类
public static ArtifactRepository convertFromMavenSettingsRepository(Repository repository)
{
MavenArtifactRepository result = new MavenArtifactRepository();
result.setId(repository.getId());
result.setUrl(repository.getUrl());
String layout = repository.getLayout();
if ("default".equals(layout))
result.setLayout(new DefaultRepositoryLayout());
else if ("p2".equals(layout))
result.setLayout(new P2ArtifactRepositoryLayout());
RepositoryPolicy releases = repository.getReleases();
if (releases != null)
result.setReleaseUpdatePolicy(new ArtifactRepositoryPolicy(releases.isEnabled(), releases.getUpdatePolicy(),
releases.getChecksumPolicy()));
RepositoryPolicy snapshots = repository.getSnapshots();
if (snapshots != null)
result.setSnapshotUpdatePolicy(new ArtifactRepositoryPolicy(snapshots.isEnabled(),
snapshots.getUpdatePolicy(),
snapshots.getChecksumPolicy()));
return result;
}
开发者ID:forge,项目名称:furnace,代码行数:26,代码来源:RepositoryUtils.java
示例4: testValidate
import org.apache.maven.settings.Repository; //导入依赖的package包/类
public void testValidate()
{
Settings model = new Settings();
Profile prof = new Profile();
prof.setId( "xxx" );
model.addProfile( prof );
SimpleProblemCollector problems = new SimpleProblemCollector();
validator.validate( model, problems );
assertEquals( 0, problems.messages.size() );
Repository repo = new Repository();
prof.addRepository( repo );
problems = new SimpleProblemCollector();
validator.validate( model, problems );
assertEquals( 2, problems.messages.size() );
repo.setUrl( "http://xxx.xxx.com" );
problems = new SimpleProblemCollector();
validator.validate( model, problems );
assertEquals( 1, problems.messages.size() );
repo.setId( "xxx" );
problems = new SimpleProblemCollector();
validator.validate( model, problems );
assertEquals( 0, problems.messages.size() );
}
开发者ID:gems-uff,项目名称:oceano,代码行数:27,代码来源:DefaultSettingsValidatorTest.java
示例5: testValidateUniqueRepositoryId
import org.apache.maven.settings.Repository; //导入依赖的package包/类
public void testValidateUniqueRepositoryId()
throws Exception
{
Settings settings = new Settings();
Profile profile = new Profile();
profile.setId( "pro" );
settings.addProfile( profile );
Repository repo1 = new Repository();
repo1.setUrl( "http://apache.org/" );
repo1.setId( "test" );
profile.addRepository( repo1 );
Repository repo2 = new Repository();
repo2.setUrl( "http://apache.org/" );
repo2.setId( "test" );
profile.addRepository( repo2 );
SimpleProblemCollector problems = new SimpleProblemCollector();
validator.validate( settings, problems );
assertEquals( 1, problems.messages.size() );
assertContains( problems.messages.get( 0 ), "'profiles.profile[pro].repositories.repository.id' must be unique"
+ " but found duplicate repository with id test" );
}
开发者ID:gems-uff,项目名称:oceano,代码行数:23,代码来源:DefaultSettingsValidatorTest.java
示例6: getRepositoryList
import org.apache.maven.settings.Repository; //导入依赖的package包/类
public static List<RemoteRepository> getRepositoryList() throws SettingsBuildingException {
List<RemoteRepository> repos = new ArrayList<RemoteRepository>();
RemoteRepository central =
new RemoteRepository.Builder("central", "default",
"http://repo1.maven.org/maven2/").build();
// Without this we wouldn't be able to find SNAPSHOT builds of plugins we
// haven't built and installed locally ourselves
RemoteRepository gateRepo = new RemoteRepository.Builder("gate", "default",
"http://repo.gate.ac.uk/content/groups/public/").build();
// Add all repos from settings.xml
// http://stackoverflow.com/questions/27818659/loading-mavens-settings-xml-for-jcabi-aether-to-use
Settings effectiveSettings = loadMavenSettings();
Map<String, Profile> profilesMap = effectiveSettings.getProfilesAsMap();
for(String profileName : effectiveSettings.getActiveProfiles()) {
Profile profile = profilesMap.get(profileName);
List<Repository> repositories = profile.getRepositories();
for(Repository repo : repositories) {
RemoteRepository remoteRepo =
new RemoteRepository.Builder(repo.getId(), "default",
repo.getUrl()).build();
repos.add(remoteRepo);
}
}
repos.add(central);
repos.add(gateRepo);
return repos;
}
开发者ID:GateNLP,项目名称:gate-core,代码行数:34,代码来源:Utils.java
示例7: addActiveProfileRepositories
import org.apache.maven.settings.Repository; //导入依赖的package包/类
private static void addActiveProfileRepositories(List<Profile> activeProfiles,
List<RepositoryConfiguration> configurations) {
for (Profile activeProfile : activeProfiles) {
Interpolator interpolator = new RegexBasedInterpolator();
interpolator.addValueSource(
new PropertiesBasedValueSource(activeProfile.getProperties()));
for (Repository repository : activeProfile.getRepositories()) {
configurations.add(getRepositoryConfiguration(interpolator, repository));
}
}
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:12,代码来源:RepositoryConfigurationFactory.java
示例8: getRepositoryConfiguration
import org.apache.maven.settings.Repository; //导入依赖的package包/类
private static RepositoryConfiguration getRepositoryConfiguration(
Interpolator interpolator, Repository repository) {
String name = interpolate(interpolator, repository.getId());
String url = interpolate(interpolator, repository.getUrl());
boolean snapshotsEnabled = false;
if (repository.getSnapshots() != null) {
snapshotsEnabled = repository.getSnapshots().isEnabled();
}
return new RepositoryConfiguration(name, URI.create(url), snapshotsEnabled);
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:11,代码来源:RepositoryConfigurationFactory.java
示例9: mavenRepositories
import org.apache.maven.settings.Repository; //导入依赖的package包/类
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;
}
开发者ID:spring-cloud,项目名称:spring-cloud-function,代码行数:15,代码来源:DependencyResolver.java
示例10: addActiveProfileRepositories
import org.apache.maven.settings.Repository; //导入依赖的package包/类
private static void addActiveProfileRepositories(List<Profile> activeProfiles,
List<RepositoryConfiguration> repositoryConfiguration) {
for (Profile activeProfile : activeProfiles) {
for (Repository repository : activeProfile.getRepositories()) {
repositoryConfiguration.add(new RepositoryConfiguration(
repository.getId(), URI.create(repository.getUrl()),
repository.getSnapshots() != null
? repository.getSnapshots().isEnabled() : false));
}
}
}
开发者ID:Nephilim84,项目名称:contestparser,代码行数:12,代码来源:RepositoryConfigurationFactory.java
示例11: validateRepositories
import org.apache.maven.settings.Repository; //导入依赖的package包/类
private void validateRepositories( SettingsProblemCollector problems, List<Repository> repositories, String prefix )
{
Set<String> repoIds = new HashSet<String>();
for ( Repository repository : repositories )
{
validateStringNotEmpty( problems, prefix + ".id", repository.getId(), repository.getUrl() );
validateBannedCharacters( problems, prefix + ".id", Severity.WARNING, repository.getId(), null,
ILLEGAL_REPO_ID_CHARS );
if ( "local".equals( repository.getId() ) )
{
addViolation( problems, Severity.WARNING, prefix + ".id", null, "must not be 'local'"
+ ", this identifier is reserved for the local repository"
+ ", using it for other repositories will corrupt your repository metadata." );
}
if ( !repoIds.add( repository.getId() ) )
{
addViolation( problems, Severity.WARNING, prefix + ".id", null,
"must be unique but found duplicate repository with id " + repository.getId() );
}
validateStringNotEmpty( problems, prefix + ".url", repository.getUrl(), repository.getId() );
if ( "legacy".equals( repository.getLayout() ) )
{
addViolation( problems, Severity.WARNING, prefix + ".layout", repository.getId(),
"uses the unsupported value 'legacy', artifact resolution might fail." );
}
}
}
开发者ID:gems-uff,项目名称:oceano,代码行数:34,代码来源:DefaultSettingsValidator.java
示例12: addSettingsProfileRepositoriesTo
import org.apache.maven.settings.Repository; //导入依赖的package包/类
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);
}
}
}
}
}
}
}
}
开发者ID:release-engineering,项目名称:pom-manipulation-ext,代码行数:65,代码来源:MavenLocationExpander.java
示例13: useActiveSettingsProfileRepos
import org.apache.maven.settings.Repository; //导入依赖的package包/类
@Test
public void useActiveSettingsProfileRepos()
throws Exception
{
final ArtifactRepositoryLayout layout = new DefaultRepositoryLayout();
final ArtifactRepositoryPolicy snapshots =
new ArtifactRepositoryPolicy( true, ArtifactRepositoryPolicy.UPDATE_POLICY_DAILY,
ArtifactRepositoryPolicy.CHECKSUM_POLICY_WARN );
final ArtifactRepositoryPolicy releases =
new ArtifactRepositoryPolicy( true, ArtifactRepositoryPolicy.UPDATE_POLICY_NEVER,
ArtifactRepositoryPolicy.CHECKSUM_POLICY_WARN );
final File localRepo = File.createTempFile( "local.repo.", ".dir" );
localRepo.deleteOnExit();
final ArtifactRepository local =
new MavenArtifactRepository( "local", localRepo.toURI()
.toString(), layout, snapshots, releases );
final Repository remote = new Repository();
remote.setId( "remote" );
remote.setUrl( "http:///repo.maven.apache.org/maven2" );
final Profile profile = new Profile();
profile.setId( "test" );
profile.addRepository( remote );
final Settings settings = new Settings();
settings.addProfile( profile );
final MavenLocationExpander ex =
new MavenLocationExpander( Collections.<Location> emptyList(),
Collections.<ArtifactRepository> emptyList(), local,
new DefaultMirrorSelector(), settings,
Collections.<String> singletonList( profile.getId() ) );
final List<Location> result = ex.expand( MavenLocationExpander.EXPANSION_TARGET );
assertThat( result.size(), equalTo( 2 ) );
final Iterator<Location> iterator = result.iterator();
Location loc = iterator.next();
assertThat( loc.getName(), equalTo( local.getId() ) );
assertThat( loc.getUri(), equalTo( local.getUrl() ) );
loc = iterator.next();
assertThat( loc.getName(), equalTo( remote.getId() ) );
assertThat( loc.getUri(), equalTo( remote.getUrl() ) );
}
开发者ID:release-engineering,项目名称:pom-manipulation-ext,代码行数:54,代码来源:MavenLocationExpanderTest.java
注:本文中的org.apache.maven.settings.Repository类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论