Class MavenContext

java.lang.Object
org.jdrupes.builder.mvnrepo.MavenContext

public final class MavenContext extends Object
Manages a global instance of RepositorySystem and RepositorySystemSession and provides lists of RemoteRepositorys from profiles in settings.xml.
  • Method Details

    • repositorySystem

      public static org.eclipse.aether.RepositorySystem repositorySystem()
      Repository system.
      Returns:
      the repository system
    • repositorySession

      public static org.eclipse.aether.RepositorySystemSession repositorySession()
      Repository session.
      Returns:
      the repository system session
    • lookupCredentials

      public static boolean lookupCredentials(String serverId, BiConsumer<String,String> consumer)
      Looks up the credentials for the specified server in settings.xml. Invokes the consumer with the username and password if found.
      Parameters:
      serverId - the server id
      consumer - the consumer
      Returns:
      true, if found
    • mavenCentral

      public static org.eclipse.aether.repository.RemoteRepository mavenCentral()
      Returns the RemoteRepository for Maven Central.
      Returns:
      the remote repository
    • repositories

      public static Stream<org.eclipse.aether.repository.RemoteRepository> repositories(String profileId)
      Return the RemoteRepositorys from the specified profile.
      Parameters:
      profileId - the profile id
      Returns:
      the repositories
    • repositories

      public static Stream<org.eclipse.aether.repository.RemoteRepository> repositories(Settings settings, String profileId)
      Return the RemoteRepositorys from the specified settings and profile.
      Parameters:
      settings - the settings
      profileId - the profile id
      Returns:
      the repositories