本文整理了Java中org.apache.maven.model.Repository.getId
方法的一些代码示例,展示了Repository.getId
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Repository.getId
方法的具体详情如下:
包路径:org.apache.maven.model.Repository
类名称:Repository
方法名:getId
暂无
代码示例来源:origin: org.apache.maven/maven-project
private void validateRepositories( final ModelValidationResult result, final List repositories, final String prefix )
{
for ( Iterator it = repositories.iterator(); it.hasNext(); )
{
Repository repository = (Repository) it.next();
validateStringNotEmpty( prefix + ".id", result, repository.getId() );
validateStringNotEmpty( prefix + ".url", result, repository.getUrl() );
}
}
代码示例来源:origin: apache/maven
private void validate20EffectiveRepository( ModelProblemCollector problems, Repository repository, String prefix,
ModelBuildingRequest request )
{
if ( repository != null )
{
Severity errOn31 = getSeverity( request, ModelBuildingRequest.VALIDATION_LEVEL_MAVEN_3_1 );
validateBannedCharacters( prefix + ".id", problems, errOn31, Version.V20, repository.getId(), null,
repository, ILLEGAL_REPO_ID_CHARS );
if ( "local".equals( repository.getId() ) )
{
addViolation( problems, errOn31, Version.V20, 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.",
repository );
}
if ( "legacy".equals( repository.getLayout() ) )
{
addViolation( problems, Severity.WARNING, Version.V20, prefix + ".layout", repository.getId(),
"uses the unsupported value 'legacy', artifact resolution might fail.", repository );
}
}
}
代码示例来源:origin: apache/maven
private void validateRawRepositories( ModelProblemCollector problems, List<Repository> repositories, String prefix,
ModelBuildingRequest request )
{
Map<String, Repository> index = new HashMap<>();
for ( Repository repository : repositories )
{
validateStringNotEmpty( prefix + ".id", problems, Severity.ERROR, Version.V20, repository.getId(),
repository );
validateStringNotEmpty( prefix + "[" + repository.getId() + "].url", problems, Severity.ERROR, Version.V20,
repository.getUrl(), repository );
String key = repository.getId();
Repository existing = index.get( key );
if ( existing != null )
{
Severity errOn30 = getSeverity( request, ModelBuildingRequest.VALIDATION_LEVEL_MAVEN_3_0 );
addViolation( problems, errOn30, Version.V20, prefix + ".id", null, "must be unique: "
+ repository.getId() + " -> " + existing.getUrl() + " vs " + repository.getUrl(), repository );
}
else
{
index.put( key, repository );
}
}
}
代码示例来源:origin: apache/maven
@Override
public void addRepository( final Repository repository, boolean replace )
throws InvalidRepositoryException
{
if ( session.isIgnoreArtifactDescriptorRepositories() )
{
return;
}
if ( !repositoryIds.add( repository.getId() ) )
{
if ( !replace )
{
return;
}
removeMatchingRepository( repositories, repository.getId() );
}
List<RemoteRepository> newRepositories =
Collections.singletonList( ArtifactDescriptorUtils.toRemoteRepository( repository ) );
this.repositories =
remoteRepositoryManager.aggregateRepositories( session, repositories, newRepositories, true );
}
代码示例来源:origin: org.apache.maven/maven-project
throw new ProjectBuildingException( projectId, "Error building artifact repository for id: " + repo.getId(), e );
代码示例来源:origin: apache/maven
@Override
public void addRepository( final Repository repository, boolean replace )
throws InvalidRepositoryException
{
if ( !repositoryIds.add( repository.getId() ) )
{
if ( !replace )
{
return;
}
// Remove any previous repository with this Id
removeMatchingRepository( repositories, repository.getId() );
removeMatchingRepository( pomRepositories, repository.getId() );
}
List<RemoteRepository> newRepositories =
Collections.singletonList( ArtifactDescriptorUtils.toRemoteRepository( repository ) );
if ( ProjectBuildingRequest.RepositoryMerging.REQUEST_DOMINANT.equals( repositoryMerging ) )
{
repositories = remoteRepositoryManager.aggregateRepositories( session, repositories, newRepositories,
true );
}
else
{
pomRepositories =
remoteRepositoryManager.aggregateRepositories( session, pomRepositories, newRepositories, true );
repositories =
remoteRepositoryManager.aggregateRepositories( session, pomRepositories, externalRepositories, false );
}
}
代码示例来源:origin: org.apache.maven/maven-project
public static ArtifactRepository buildArtifactRepository( Repository repo,
ArtifactRepositoryFactory artifactRepositoryFactory,
PlexusContainer container )
throws InvalidRepositoryException
{
if ( repo != null )
{
String id = repo.getId();
String url = repo.getUrl();
if ( id == null || id.trim().length() < 1 )
{
throw new InvalidRepositoryException( "Repository ID must not be empty (URL is: " + url + ").", new IllegalArgumentException( "repository.id" ) );
}
if ( url == null || url.trim().length() < 1 )
{
throw new InvalidRepositoryException( "Repository URL must not be empty (ID is: " + id + ").", new IllegalArgumentException( "repository.url" ) );
}
// TODO: make this a map inside the factory instead, so no lookup needed
ArtifactRepositoryLayout layout = getRepositoryLayout( repo, container );
ArtifactRepositoryPolicy snapshots = buildArtifactRepositoryPolicy( repo.getSnapshots() );
ArtifactRepositoryPolicy releases = buildArtifactRepositoryPolicy( repo.getReleases() );
return artifactRepositoryFactory.createArtifactRepository( id, url, layout, snapshots, releases );
}
else
{
return null;
}
}
代码示例来源:origin: apache/maven
public static ArtifactRepository buildArtifactRepository( org.apache.maven.model.Repository repo )
throws InvalidRepositoryException
{
if ( repo != null )
{
String id = repo.getId();
if ( StringUtils.isEmpty( id ) )
{
throw new InvalidRepositoryException( "Repository identifier missing", "" );
}
String url = repo.getUrl();
if ( StringUtils.isEmpty( url ) )
{
throw new InvalidRepositoryException( "URL missing for repository " + id, id );
}
ArtifactRepositoryPolicy snapshots = buildArtifactRepositoryPolicy( repo.getSnapshots() );
ArtifactRepositoryPolicy releases = buildArtifactRepositoryPolicy( repo.getReleases() );
ArtifactRepositoryLayout layout = new DefaultRepositoryLayout();
return createArtifactRepository( id, url, layout, snapshots, releases );
}
else
{
return null;
}
}
代码示例来源:origin: apache/maven
public ArtifactRepository buildArtifactRepository( Repository repo )
throws InvalidRepositoryException
{
if ( repo != null )
{
String id = repo.getId();
if ( StringUtils.isEmpty( id ) )
{
throw new InvalidRepositoryException( "Repository identifier missing", "" );
}
String url = repo.getUrl();
if ( StringUtils.isEmpty( url ) )
{
throw new InvalidRepositoryException( "URL missing for repository " + id, id );
}
ArtifactRepositoryPolicy snapshots = buildArtifactRepositoryPolicy( repo.getSnapshots() );
ArtifactRepositoryPolicy releases = buildArtifactRepositoryPolicy( repo.getReleases() );
return createArtifactRepository( id, url, getLayout( repo.getLayout() ), snapshots, releases );
}
else
{
return null;
}
}
代码示例来源:origin: apache/maven
public static RemoteRepository toRemoteRepository( Repository repository )
{
RemoteRepository.Builder builder =
new RemoteRepository.Builder( repository.getId(), repository.getLayout(), repository.getUrl() );
builder.setSnapshotPolicy( toRepositoryPolicy( repository.getSnapshots() ) );
builder.setReleasePolicy( toRepositoryPolicy( repository.getReleases() ) );
return builder.build();
}
代码示例来源:origin: apache/maven
private void configureResolver( ModelResolver modelResolver, Model model, DefaultModelProblemCollector problems,
boolean replaceRepositories )
{
if ( modelResolver == null )
{
return;
}
problems.setSource( model );
List<Repository> repositories = model.getRepositories();
for ( Repository repository : repositories )
{
try
{
modelResolver.addRepository( repository, replaceRepositories );
}
catch ( InvalidRepositoryException e )
{
problems.add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE )
.setMessage( "Invalid repository " + repository.getId() + ": " + e.getMessage() )
.setLocation( repository.getLocation( "" ) ).setException( e ) );
}
}
}
代码示例来源:origin: apache/maven
if ( repository.getId() != null )
serializer.startTag( NAMESPACE, "id" ).text( repository.getId() ).endTag( NAMESPACE, "id" );
代码示例来源:origin: apache/maven
/**
* @param modelRepo
* @return a repository
*/
private static Repository convertToSettingsRepository( org.apache.maven.model.Repository modelRepo )
{
Repository repo = new Repository();
repo.setId( modelRepo.getId() );
repo.setLayout( modelRepo.getLayout() );
repo.setName( modelRepo.getName() );
repo.setUrl( modelRepo.getUrl() );
if ( modelRepo.getSnapshots() != null )
{
repo.setSnapshots( convertRepositoryPolicy( modelRepo.getSnapshots() ) );
}
if ( modelRepo.getReleases() != null )
{
repo.setReleases( convertRepositoryPolicy( modelRepo.getReleases() ) );
}
return repo;
}
代码示例来源:origin: takari/polyglot-maven
out.write(", name -> \"" + repository.getName() + "\"");
if (repository.getId() != null) {
out.write(", id -> \"" + repository.getId() + "\"");
代码示例来源:origin: takari/polyglot-maven
private void printRepositories(String name,
Repository... repositories) {
for (Repository r: repositories) {
if ( r.getReleases() == null && r.getSnapshots() == null )
{
p.printWithOptions( name,
options( "id", r.getId(),
"name", r.getName(),
"url", r.getUrl() ) );
}
else
{
p.printStartBlock( name,
options( "id", r.getId(),
"name", r.getName(),
"url", r.getUrl() ) );
printRepositoryPolicy( "releases", r.getReleases() );
printRepositoryPolicy( "snapshots", r.getSnapshots() );
p.printEndBlock();
}
}
}
代码示例来源:origin: Spirals-Team/repairnator
@Override
public void addRepository(Repository repository, boolean b) throws InvalidRepositoryException {
for (Repository existingRepository : repositories) {
if (existingRepository.getId().equals(repository.getId()) && !b) {
return;
}
}
repositories.add(repository);
}
代码示例来源:origin: takari/polyglot-maven
if ( repository.getId() != null )
serializer.attribute( NAMESPACE, "id", repository.getId() );
代码示例来源:origin: com.atlassian.sdk/ap3-aether-maven-provider
public void addRepository( Repository repository )
throws InvalidRepositoryException
{
if ( !repositoryIds.add( repository.getId() ) )
{
return;
}
List<RemoteRepository> newRepositories =
Collections.singletonList(ArtifactDescriptorUtils.toRemoteRepository(repository));
this.repositories =
remoteRepositoryManager.aggregateRepositories( session, repositories, newRepositories, true );
}
代码示例来源:origin: org.apache.maven/maven-resolver-provider
public static RemoteRepository toRemoteRepository( Repository repository )
{
RemoteRepository.Builder builder =
new RemoteRepository.Builder( repository.getId(), repository.getLayout(), repository.getUrl() );
builder.setSnapshotPolicy( toRepositoryPolicy( repository.getSnapshots() ) );
builder.setReleasePolicy( toRepositoryPolicy( repository.getReleases() ) );
return builder.build();
}
代码示例来源:origin: io.tesla.maven/maven-aether-provider
public static RemoteRepository toRemoteRepository( Repository repository )
{
RemoteRepository.Builder builder =
new RemoteRepository.Builder( repository.getId(), repository.getLayout(), repository.getUrl() );
builder.setSnapshotPolicy( toRepositoryPolicy( repository.getSnapshots() ) );
builder.setReleasePolicy( toRepositoryPolicy( repository.getReleases() ) );
return builder.build();
}
内容来源于网络,如有侵权,请联系作者删除!