org.apache.maven.settings.Repository.getLayout()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(12.6k)|赞(0)|评价(0)|浏览(96)

本文整理了Java中org.apache.maven.settings.Repository.getLayout方法的一些代码示例,展示了Repository.getLayout的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Repository.getLayout方法的具体详情如下:
包路径:org.apache.maven.settings.Repository
类名称:Repository
方法名:getLayout

Repository.getLayout介绍

暂无

代码示例

代码示例来源:origin: apache/maven

private void validateRepositories( SettingsProblemCollector problems, List<Repository> repositories, String prefix )
{
  Set<String> repoIds = new HashSet<>();
  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." );
    }
  }
}

代码示例来源:origin: apache/maven

if ( ( repository.getLayout() != null ) && !repository.getLayout().equals( "default" ) )
  serializer.startTag( NAMESPACE, "layout" ).text( repository.getLayout() ).endTag( NAMESPACE, "layout" );

代码示例来源:origin: apache/maven

public static org.apache.maven.model.Repository fromSettingsRepository( org.apache.maven.settings.Repository
                                    settingsRepository )
{
  org.apache.maven.model.Repository modelRepository = new org.apache.maven.model.Repository();
  modelRepository.setId( settingsRepository.getId() );
  modelRepository.setLayout( settingsRepository.getLayout() );
  modelRepository.setName( settingsRepository.getName() );
  modelRepository.setUrl( settingsRepository.getUrl() );
  modelRepository.setReleases( fromSettingsRepositoryPolicy( settingsRepository.getReleases() ) );
  modelRepository.setSnapshots( fromSettingsRepositoryPolicy( settingsRepository.getSnapshots() ) );
  return modelRepository;
}

代码示例来源:origin: apache/maven

/**
 * @param settingsRepo
 * @return a repository
 */
private static org.apache.maven.model.Repository convertFromSettingsRepository( Repository settingsRepo )
{
  org.apache.maven.model.Repository repo = new org.apache.maven.model.Repository();
  repo.setId( settingsRepo.getId() );
  repo.setLayout( settingsRepo.getLayout() );
  repo.setName( settingsRepo.getName() );
  repo.setUrl( settingsRepo.getUrl() );
  if ( settingsRepo.getSnapshots() != null )
  {
    repo.setSnapshots( convertRepositoryPolicy( settingsRepo.getSnapshots() ) );
  }
  if ( settingsRepo.getReleases() != null )
  {
    repo.setReleases( convertRepositoryPolicy( settingsRepo.getReleases() ) );
  }
  return repo;
}

代码示例来源:origin: org.apache.maven/maven-settings

if ( ( repository.getLayout() != null ) && !repository.getLayout().equals( "default" ) )
  serializer.startTag( NAMESPACE, "layout" ).text( repository.getLayout() ).endTag( NAMESPACE, "layout" );

代码示例来源:origin: org.jboss.forge/maven-impl

public List<RemoteRepository> getEnabledRepositoriesFromProfile(Settings settings)
{
 List<RemoteRepository> settingsRepos = new ArrayList<RemoteRepository>();
 List<String> activeProfiles = settings.getActiveProfiles();
 Map<String, Profile> profiles = settings.getProfilesAsMap();
 for (String id : activeProfiles)
 {
   Profile profile = profiles.get(id);
   if (profile != null)
   {
    List<Repository> repositories = profile.getRepositories();
    for (Repository repository : repositories)
    {
      settingsRepos.add(new RemoteRepository(repository.getId(), repository.getLayout(), repository.getUrl()));
    }
   }
 }
 return settingsRepos;
}

代码示例来源:origin: org.jboss.galleon/galleon-cli

repos.put(repo.getId(), buildRepository(repo.getId(), repo.getLayout(),
    repo.getUrl(), settings, repo.getReleases(), repo.getSnapshots(), null));

代码示例来源:origin: org.jboss.forge.furnace/furnace-manager-resolver-maven

for (Repository repository : repositories)
  settingsRepos.add(new RemoteRepository.Builder(repository.getId(), repository.getLayout(), repository
      .getUrl()).build());

代码示例来源:origin: org.kie.soup/kie-soup-maven-integration

private static RemoteRepository.Builder toRemoteRepositoryBuilder( Settings settings,
                                  Repository repository ) {
  RemoteRepository.Builder remoteBuilder = toRemoteRepositoryBuilder( settings,
                                    repository.getId(),
                                    repository.getLayout(),
                                    repository.getUrl() );
  setPolicy( remoteBuilder, repository.getSnapshots(),
        true );
  setPolicy( remoteBuilder, repository.getReleases(),
        false );
  return remoteBuilder;
}

代码示例来源:origin: org.uberfire/uberfire-maven-integration

private static RemoteRepository.Builder toRemoteRepositoryBuilder( Settings settings,
                                  Repository repository ) {
  RemoteRepository.Builder remoteBuilder = toRemoteRepositoryBuilder( settings,
                                    repository.getId(),
                                    repository.getLayout(),
                                    repository.getUrl() );
  setPolicy( remoteBuilder, repository.getSnapshots(),
        true );
  setPolicy( remoteBuilder, repository.getReleases(),
        false );
  return remoteBuilder;
}

代码示例来源:origin: org.apache.maven/maven-settings-builder

private void validateRepositories( SettingsProblemCollector problems, List<Repository> repositories, String prefix )
{
  Set<String> repoIds = new HashSet<>();
  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." );
    }
  }
}

代码示例来源:origin: io.tesla.maven/maven-settings-builder

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." );
    }
  }
}

代码示例来源:origin: org.jboss.shrinkwrap.resolver/shrinkwrap-resolver-impl-maven

/**
 * Converts Maven {@link Repository} to Aether {@link RemoteRepository}
 *
 * @param repository
 * the Maven repository to be converted
 * @return Equivalent remote repository
 */
public static RemoteRepository asRemoteRepository(org.apache.maven.settings.Repository repository) {
  return new RemoteRepository.Builder(repository.getId(), repository.getLayout(), repository.getUrl())
      .setSnapshotPolicy(asRepositoryPolicy(repository.getSnapshots()))
      .setReleasePolicy(asRepositoryPolicy(repository.getReleases())).build();
}

代码示例来源:origin: shrinkwrap/resolver

/**
 * Converts Maven {@link Repository} to Aether {@link RemoteRepository}
 *
 * @param repository
 * the Maven repository to be converted
 * @return Equivalent remote repository
 */
public static RemoteRepository asRemoteRepository(org.apache.maven.settings.Repository repository) {
  return new RemoteRepository.Builder(repository.getId(), repository.getLayout(), repository.getUrl())
      .setSnapshotPolicy(asRepositoryPolicy(repository.getSnapshots()))
      .setReleasePolicy(asRepositoryPolicy(repository.getReleases())).build();
}

代码示例来源:origin: org.jboss.forge.addon/maven-impl-projects

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 ("flat".equals(layout))
   result.setLayout(new FlatRepositoryLayout());
 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;
}

代码示例来源:origin: org.jboss.shrinkwrap.resolver/shrinkwrap-resolver-impl-maven

private static Repository asRepository(org.apache.maven.settings.Repository repository) {
  Repository mavenRepository = new Repository();
  if (repository != null) {
    mavenRepository.setId(repository.getId());
    mavenRepository.setLayout(repository.getLayout());
    mavenRepository.setName(repository.getName());
    mavenRepository.setUrl(repository.getUrl());
    mavenRepository.setReleases(asMavenRepositoryPolicy(repository.getReleases()));
    mavenRepository.setSnapshots(asMavenRepositoryPolicy(repository.getSnapshots()));
  }
  return mavenRepository;
}

代码示例来源:origin: shrinkwrap/resolver

private static Repository asRepository(org.apache.maven.settings.Repository repository) {
  Repository mavenRepository = new Repository();
  if (repository != null) {
    mavenRepository.setId(repository.getId());
    mavenRepository.setLayout(repository.getLayout());
    mavenRepository.setName(repository.getName());
    mavenRepository.setUrl(repository.getUrl());
    mavenRepository.setReleases(asMavenRepositoryPolicy(repository.getReleases()));
    mavenRepository.setSnapshots(asMavenRepositoryPolicy(repository.getSnapshots()));
  }
  return mavenRepository;
}

代码示例来源:origin: org.netbeans.api/org-netbeans-modules-maven-embedder

/**
 * Method updateRepository.
 * 
 * @param value
 * @param element
 * @param counter
 * @param xmlTag
 */
protected void updateRepository(Repository value, String xmlTag, Counter counter, Element element)
{
  Element root = element;
  Counter innerCount = new Counter(counter.getDepth() + 1);
  updateRepositoryPolicy( value.getReleases(), "releases", innerCount, root);
  updateRepositoryPolicy( value.getSnapshots(), "snapshots", innerCount, root);
  findAndReplaceSimpleElement(innerCount, root,  "id", value.getId(), null);
  findAndReplaceSimpleElement(innerCount, root,  "name", value.getName(), null);
  findAndReplaceSimpleElement(innerCount, root,  "url", value.getUrl(), null);
  findAndReplaceSimpleElement(innerCount, root,  "layout", value.getLayout(), "default");
} //-- void updateRepository(Repository, String, Counter, Element)

代码示例来源:origin: org.codehaus.mevenide/nb-mvn-embedder

/**
 * Method updateRepository
 * 
 * @param value
 * @param element
 * @param counter
 * @param xmlTag
 */
protected void updateRepository(Repository value, String xmlTag, Counter counter, Element element)
{
  Element root = element;
  Counter innerCount = new Counter(counter.getDepth() + 1);
  updateRepositoryPolicy( value.getReleases(), "releases", innerCount, root);
  updateRepositoryPolicy( value.getSnapshots(), "snapshots", innerCount, root);
  findAndReplaceSimpleElement(innerCount, root,  "id", value.getId(), null);
  findAndReplaceSimpleElement(innerCount, root,  "name", value.getName(), null);
  findAndReplaceSimpleElement(innerCount, root,  "url", value.getUrl(), null);
  findAndReplaceSimpleElement(innerCount, root,  "layout", value.getLayout(), "default");
} //-- void updateRepository(Repository, String, Counter, Element)

相关文章