本文整理汇总了Java中org.apache.maven.model.Repository类的典型用法代码示例。如果您正苦于以下问题:Java Repository类的具体用法?Java Repository怎么用?Java Repository使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Repository类属于org.apache.maven.model包,在下文中一共展示了Repository类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visitPluginRepository
import org.apache.maven.model.Repository; //导入依赖的package包/类
private void visitPluginRepository( ModelVisitor visitor, Repository repository )
{
RepositoryPolicy releases = repository.getReleases();
if ( releases != null )
{
visitor.visitPluginRepositoryRelease( releases );
releases = visitor.replacePluginRepositoryRelease( releases );
repository.setReleases( releases );
}
RepositoryPolicy snapshots = repository.getSnapshots();
if ( snapshots != null )
{
visitor.visitPluginRepositorySnapshot( snapshots );
snapshots = visitor.replacePluginRepositorySnapshot( snapshots );
repository.setSnapshots( snapshots );
}
}
示例2: visitProfilePluginRepository
import org.apache.maven.model.Repository; //导入依赖的package包/类
private void visitProfilePluginRepository( ModelVisitor visitor, Repository repository )
{
RepositoryPolicy releases = repository.getReleases();
if ( releases != null )
{
visitor.visitProfilePluginRepositoryRelease( releases );
releases = visitor.replaceProfilePluginRepositoryRelease( releases );
repository.setReleases( releases );
}
RepositoryPolicy snapshots = repository.getSnapshots();
if ( snapshots != null )
{
visitor.visitProfilePluginRepositorySnapshot( snapshots );
snapshots = visitor.replaceProfilePluginRepositorySnapshot( snapshots );
repository.setSnapshots( snapshots );
}
}
示例3: visitProfileRepository
import org.apache.maven.model.Repository; //导入依赖的package包/类
private void visitProfileRepository( ModelVisitor visitor, Repository repository )
{
RepositoryPolicy releases = repository.getReleases();
if ( releases != null )
{
visitor.visitProfileRepositoryRelease( releases );
releases = visitor.replaceProfileRepositoryRelease( releases );
repository.setReleases( releases );
}
RepositoryPolicy snapshots = repository.getSnapshots();
if ( snapshots != null )
{
visitor.visitProfileRepositorySnapshot( snapshots );
snapshots = visitor.replaceProfileRepositorySnapshot( snapshots );
repository.setSnapshots( snapshots );
}
}
示例4: visitRepository
import org.apache.maven.model.Repository; //导入依赖的package包/类
private void visitRepository( ModelVisitor visitor, Repository repository )
{
RepositoryPolicy releases = repository.getReleases();
if ( releases != null )
{
visitor.visitRepositoryRelease( releases );
releases = visitor.replaceRepositoryRelease( releases );
repository.setReleases( releases );
}
RepositoryPolicy snapshots = repository.getSnapshots();
if ( snapshots != null )
{
visitor.visitRepositorySnapshot( snapshots );
snapshots = visitor.replaceRepositorySnapshot( snapshots );
repository.setSnapshots( snapshots );
}
}
示例5: mavenProjectFor
import org.apache.maven.model.Repository; //导入依赖的package包/类
public MavenProject mavenProjectFor(File pom, List<Property> properties) throws Exception {
MavenXpp3Reader reader = new MavenXpp3Reader();
Model model = reader.read(new FileReader(pom));
for (Property p : properties) {
model.addProperty(p.name, p.value);
}
model.setRepositories(new ArrayList<Repository>());
MavenProject project = new MavenProject(model);
project.setPluginArtifactRepositories(new ArrayList<ArtifactRepository>());
project.setFile(pom);
return project;
}
示例6: createFlattenedRepositories
import org.apache.maven.model.Repository; //导入依赖的package包/类
/**
* Creates a flattened {@link List} of {@link Repository} elements where those from super-POM are omitted.
*
* @param repositories is the {@link List} of {@link Repository} elements. May be <code>null</code>.
* @return the flattened {@link List} of {@link Repository} elements or <code>null</code> if <code>null</code> was
* given.
*/
protected static List<Repository> createFlattenedRepositories( List<Repository> repositories )
{
if ( repositories != null )
{
List<Repository> flattenedRepositories = new ArrayList<Repository>( repositories.size() );
for ( Repository repo : repositories )
{
// filter inherited repository section from super POM (see MOJO-2042)...
if ( !isCentralRepositoryFromSuperPom( repo ) )
{
flattenedRepositories.add( repo );
}
}
return flattenedRepositories;
}
return repositories;
}
示例7: isCentralRepositoryFromSuperPom
import org.apache.maven.model.Repository; //导入依赖的package包/类
/**
* This method determines if the given {@link Repository} section is identical to what is defined from the super
* POM.
*
* @param repo is the {@link Repository} section to check.
* @return <code>true</code> if maven central default configuration, <code>false</code> otherwise.
*/
private static boolean isCentralRepositoryFromSuperPom( Repository repo )
{
if ( repo != null )
{
if ( "central".equals( repo.getId() ) )
{
RepositoryPolicy snapshots = repo.getSnapshots();
if ( snapshots != null && !snapshots.isEnabled() )
{
return true;
}
}
}
return false;
}
示例8: convertRepositories
import org.apache.maven.model.Repository; //导入依赖的package包/类
private static List<MavenRemoteRepository> convertRepositories(List<Repository> repositories) {
List<MavenRemoteRepository> result = new ArrayList<>();
if (repositories != null) {
for (Repository repo : repositories) {
result.add(
new MavenRemoteRepository(
repo.getId(),
repo.getName(),
repo.getUrl(),
repo.getLayout(),
convertPolicy(repo.getReleases()),
convertPolicy(repo.getSnapshots())));
}
}
return result;
}
示例9: convertToMavenRepository
import org.apache.maven.model.Repository; //导入依赖的package包/类
public static Repository convertToMavenRepository(MavenRemoteRepository repository) {
Repository result = new Repository();
result.setId(repository.getId());
result.setName(repository.getName());
result.setUrl(repository.getUrl());
if (repository.getLayout() == null) {
result.setLayout("default");
} else {
result.setLayout(repository.getLayout());
}
if (repository.getSnapshotsPolicy() != null) {
result.setSnapshots(convertToMavenPolicy(repository.getSnapshotsPolicy()));
}
if (repository.getReleasesPolicy() != null) {
result.setReleases(convertToMavenPolicy(repository.getReleasesPolicy()));
}
return result;
}
示例10: removeRepository
import org.apache.maven.model.Repository; //导入依赖的package包/类
/**
* Examine the repository to see if we should not remove it.
* @param state to query the ignoreLocal value
* @param repo the repository to examine
* @return boolean whether to remove this repository
*/
private boolean removeRepository (RepoReportingState state, Repository repo)
{
boolean result = true;
if (state.ignoreLocal())
{
String url = repo.getUrl();
// According to https://maven.apache.org/plugins/maven-site-plugin/examples/adding-deploy-protocol.html
// supported repositories are file, http and https.
if (url.startsWith( "file:" ) ||
url.startsWith( "http://localhost" ) ||
url.startsWith( "https://localhost" ) ||
url.startsWith( "http://127.0.0.1" ) ||
url.startsWith( "https://127.0.0.1" ) ||
url.startsWith( "http://::1" ) ||
url.startsWith( "https://::1" ) )
{
result = false;
}
}
return result;
}
开发者ID:release-engineering,项目名称:pom-manipulation-ext,代码行数:29,代码来源:RepoAndReportingRemovalManipulator.java
示例11: addRepository
import org.apache.maven.model.Repository; //导入依赖的package包/类
/**
* Add the repository to the list of repositories. If an existing repository has the same
* id it is removed first.
*
* @param repositories the current list of repositories
* @param repository the repository to add
*/
private void addRepository( final List<Repository> repositories, final Repository repository )
{
final Iterator<Repository> i = repositories.iterator();
while ( i.hasNext() )
{
final Repository r = i.next();
if ( repository.getId().equals( r.getId() ) )
{
logger.debug("Removing local repository {} ", r);
i.remove();
break;
}
}
logger.debug( "Adding repository {}", repository );
repositories.add(repository);
}
开发者ID:release-engineering,项目名称:pom-manipulation-ext,代码行数:26,代码来源:RepositoryInjectionManipulator.java
示例12: addRepository
import org.apache.maven.model.Repository; //导入依赖的package包/类
@Override
public void addRepository(final Repository repository, boolean replace) throws InvalidRepositoryException
{
if (session.isIgnoreArtifactDescriptorRepositories())
{
return;
}
if (!repositoryIds.add(repository.getId()))
{
if (!replace)
{
return;
}
removeMatchingRepository(repository.getId());
}
repositories.add(new RemoteRepository.Builder(repository.getId(), repository.getName(), repository.getUrl())
.build());
}
示例13: buildArtifactRepository
import org.apache.maven.model.Repository; //导入依赖的package包/类
public static ArtifactRepository buildArtifactRepository( Repository repo,
ArtifactRepositoryFactory artifactRepositoryFactory,
PlexusContainer c )
throws InvalidRepositoryException
{
RepositorySystem repositorySystem = rs( c );
RepositorySystemSession session = rss( c );
ArtifactRepository repository = repositorySystem.buildArtifactRepository( repo );
if ( session != null )
{
repositorySystem.injectMirror( session, Arrays.asList( repository ) );
repositorySystem.injectProxy( session, Arrays.asList( repository ) );
repositorySystem.injectAuthentication( session, Arrays.asList( repository ) );
}
return repository;
}
示例14: convertFromProfileXmlRepository
import org.apache.maven.model.Repository; //导入依赖的package包/类
private static Repository convertFromProfileXmlRepository( org.apache.maven.profiles.Repository profileXmlRepo )
{
Repository repo = new Repository();
repo.setId( profileXmlRepo.getId() );
repo.setLayout( profileXmlRepo.getLayout() );
repo.setName( profileXmlRepo.getName() );
repo.setUrl( profileXmlRepo.getUrl() );
if ( profileXmlRepo.getSnapshots() != null )
{
repo.setSnapshots( convertRepositoryPolicy( profileXmlRepo.getSnapshots() ) );
}
if ( profileXmlRepo.getReleases() != null )
{
repo.setReleases( convertRepositoryPolicy( profileXmlRepo.getReleases() ) );
}
return repo;
}
示例15: getRemoteRepositories
import org.apache.maven.model.Repository; //导入依赖的package包/类
protected List<ArtifactRepository> getRemoteRepositories()
throws Exception
{
File repoDir = new File( getBasedir(), "src/test/remote-repo" ).getAbsoluteFile();
RepositoryPolicy policy = new RepositoryPolicy();
policy.setEnabled( true );
policy.setChecksumPolicy( "ignore" );
policy.setUpdatePolicy( "always" );
Repository repository = new Repository();
repository.setId( RepositorySystem.DEFAULT_REMOTE_REPO_ID );
repository.setUrl( "file://" + repoDir.toURI().getPath() );
repository.setReleases( policy );
repository.setSnapshots( policy );
return Arrays.asList( repositorySystem.buildArtifactRepository( repository ) );
}