Class MavenAetherUtils

java.lang.Object
org.apache.maven.shared.transfer.project.MavenAetherUtils

public class MavenAetherUtils extends Object
This util class will import the Aether library available from the installed Maven distribution. It will do nothing if it is called from outside of a ClassRealm.
Since:
0.11.1
  • Field Details

    • LOGGER

      private static final org.slf4j.Logger LOGGER
    • NO_SUCH_REALM_EXCEPTION

      private static final String NO_SUCH_REALM_EXCEPTION
      See Also:
  • Constructor Details

    • MavenAetherUtils

      public MavenAetherUtils()
  • Method Details

    • importAetherLibrary

      public static void importAetherLibrary()
      Import the core Aether library from the maven distribution.
    • importAether

      private static void importAether(ClassLoader classLoader)
      Imports aether-util library from the user's Maven distribution.

      PRECONDITION: the classLoader parameter is an instance of ClassRealm.

      Parameters:
      classLoader - the Classloader which needs to access aether-util.
    • isClassRealm

      private static boolean isClassRealm(ClassLoader classLoader)
      Using reflection, check if the Classloader is actually an instance of a ClassRealm.
      Parameters:
      classLoader - the Classloader to test.
      Returns:
      true if it an instance of ClassRealm; false otherwise.