Example #1
0
 public static LoadPomTask loadPomFromClassLoaderResource(
     String pathToPomResource, ClassLoader cl, String... profiles)
     throws IllegalArgumentException, InvalidConfigurationFileException {
   Validate.notNullOrEmpty(pathToPomResource, "path to CL resource must be specified");
   Validate.notNull(cl, "ClassLoader must be specified");
   final File file = FileUtil.INSTANCE.fileFromClassLoaderResource(pathToPomResource, cl);
   return new LoadPomTask(file, profiles);
 }
Example #2
0
  @Override
  public MavenWorkingSession execute(final MavenWorkingSession session) {

    Validate.notNull(pomFile, "Path to pom.xml file must not be null");
    Validate.readable(
        pomFile, "Path to the POM ('" + pomFile + "') file must be defined and accessible");

    return session.loadPomFromFile(pomFile, profiles);
  }
Example #3
0
  public static LoadPomTask loadPomFromFile(final String pathToPomFile, final String... profiles)
      throws IllegalArgumentException, InvalidConfigurationFileException {

    Validate.notNullOrEmpty(pathToPomFile, "Path to a POM file must be specified");
    Validate.readable(
        pathToPomFile,
        "Path to the pom.xml ('" + pathToPomFile + "')file must be defined and accessible");

    return new LoadPomTask(new File(pathToPomFile), profiles);
  }
  /**
   * Gets manager for local repository
   *
   * @return the manager
   */
  public LocalRepositoryManager localRepositoryManager(
      final RepositorySystemSession session, boolean legacyLocalRepository) {
    Validate.notNull(session, "session must be specified");
    String localRepositoryPath = settings.getLocalRepository();
    Validate.notNullOrEmpty(localRepositoryPath, "Path to a local repository must be defined");

    SWRLocalRepositoryManager factory = SWRLocalRepositoryManager.ENHANCED;
    // here we rely either on system property or flag passed by caller
    if (useLegacyLocalRepository || legacyLocalRepository) {
      factory = SWRLocalRepositoryManager.LEGACY;
    }
    if (settings.isOffline()) {
      factory = SWRLocalRepositoryManager.SIMPLE;
    }

    LocalRepositoryManager manager =
        factory.localRepositoryManager(system, session, new File(localRepositoryPath));
    return manager;
  }
Example #5
0
 public static LoadPomTask loadPomFromFile(final File pomFile, final String... profiles) {
   Validate.notNull(pomFile, "POM file must be specified");
   return new LoadPomTask(pomFile, profiles);
 }