Java Code Examples for org.apache.maven.model.Repository#getSnapshots()

The following examples show how to use org.apache.maven.model.Repository#getSnapshots() . 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: FlattenMojo.java    From flatten-maven-plugin with Apache License 2.0 6 votes vote down vote up
/**
 * 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;
}
 
Example 2
Source File: LocationAwareMavenXpp3Writer.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void writeRepository(Repository repository, String tagName, XmlSerializer serializer)
        throws java.io.IOException {
    serializer.startTag(NAMESPACE, tagName);
    flush(serializer);
    StringBuffer b = b(serializer);
    int start = b.length();
    if (repository.getReleases() != null) {
        writeRepositoryPolicy((RepositoryPolicy) repository.getReleases(), "releases", serializer);
    }
    if (repository.getSnapshots() != null) {
        writeRepositoryPolicy((RepositoryPolicy) repository.getSnapshots(), "snapshots", serializer);
    }
    if (repository.getId() != null) {
        writeValue(serializer, "id", repository.getId(), repository);
    }
    if (repository.getName() != null) {
        writeValue(serializer, "name", repository.getName(), repository);
    }
    if (repository.getUrl() != null) {
        writeValue(serializer, "url", repository.getUrl(), repository);
    }
    if ((repository.getLayout() != null) && !repository.getLayout().equals("default")) {
        writeValue(serializer, "layout", repository.getLayout(), repository);
    }
    serializer.endTag(NAMESPACE, tagName).flush();
    logLocation(repository, "", start, b.length());
}