@SuppressWarnings("NewApi")
  public URL[] getLocalArtifactUrls(DependencyJar... dependencies) {
    DependenciesTask dependenciesTask = createDependenciesTask();
    configureMaven(dependenciesTask);
    RemoteRepository remoteRepository = new RemoteRepository();
    remoteRepository.setUrl(repositoryUrl);
    remoteRepository.setId(repositoryId);
    if (repositoryUserName != null || repositoryPassword != null) {
      Authentication authentication = new Authentication();
      authentication.setUserName(repositoryUserName);
      authentication.setPassword(repositoryPassword);
      remoteRepository.addAuthentication(authentication);
    }
    dependenciesTask.addConfiguredRemoteRepository(remoteRepository);
    final Project project = new Project();
    dependenciesTask.setProject(project);
    for (DependencyJar dependencyJar : dependencies) {
      Dependency dependency = new Dependency();
      dependency.setArtifactId(dependencyJar.getArtifactId());
      dependency.setGroupId(dependencyJar.getGroupId());
      dependency.setType(dependencyJar.getType());
      dependency.setVersion(dependencyJar.getVersion());
      if (dependencyJar.getClassifier() != null) {
        dependency.setClassifier(dependencyJar.getClassifier());
      }
      dependenciesTask.addDependency(dependency);
    }

    whileLocked(dependenciesTask::execute);

    @SuppressWarnings("unchecked")
    Hashtable<String, String> artifacts = project.getProperties();
    URL[] urls = new URL[dependencies.length];
    for (int i = 0; i < urls.length; i++) {
      try {
        urls[i] = Paths.get(artifacts.get(key(dependencies[i]))).toUri().toURL();
      } catch (MalformedURLException e) {
        throw new RuntimeException(e);
      }
    }
    return urls;
  }
@SuppressWarnings("NewApi")
  public URL[] getLocalArtifactUrls(DependencyJar... dependencies) {
    DependenciesTask dependenciesTask = createDependenciesTask();
    configureMaven(dependenciesTask);
    RemoteRepository remoteRepository = new RemoteRepository();
    remoteRepository.setUrl(repositoryUrl);
    remoteRepository.setId(repositoryId);
    if (repositoryUserName != null || repositoryPassword != null) {
      Authentication authentication = new Authentication();
      authentication.setUserName(repositoryUserName);
      authentication.setPassword(repositoryPassword);
      remoteRepository.addAuthentication(authentication);
    }
    dependenciesTask.addConfiguredRemoteRepository(remoteRepository);
    final Project project = new Project();
    dependenciesTask.setProject(project);
    for (DependencyJar dependencyJar : dependencies) {
      Dependency dependency = new Dependency();
      dependency.setArtifactId(dependencyJar.getArtifactId());
      dependency.setGroupId(dependencyJar.getGroupId());
      dependency.setType(dependencyJar.getType());
      dependency.setVersion(dependencyJar.getVersion());
      if (dependencyJar.getClassifier() != null) {
        dependency.setClassifier(dependencyJar.getClassifier());
      }
      dependenciesTask.addDependency(dependency);
    }

    whileLocked(dependenciesTask::execute);

    @SuppressWarnings("unchecked")
    Hashtable<String, String> artifacts = project.getProperties();
    URL[] urls = new URL[dependencies.length];
    for (int i = 0; i < urls.length; i++) {
      try {
        urls[i] = Paths.get(artifacts.get(key(dependencies[i]))).toUri().toURL();
      } catch (MalformedURLException e) {
        throw new RuntimeException(e);
      }
    }
    return urls;
  }
@ SuppressWarnings ( "NewApi" ) public URL [ ] getLocalArtifactUrls ( DependencyJar ... dependencies ) { DependenciesTask dependenciesTask = createDependenciesTask ( ) ; configureMaven ( dependenciesTask ) ; RemoteRepository remoteRepository = new RemoteRepository ( ) ; remoteRepository . setUrl ( repositoryUrl ) ; remoteRepository . setId ( repositoryId ) ; if ( repositoryUserName != null || repositoryPassword != null ) { Authentication authentication = new Authentication ( ) ; authentication . setUserName ( repositoryUserName ) ; authentication . setPassword ( repositoryPassword ) ; remoteRepository . addAuthentication ( authentication ) ; } dependenciesTask . addConfiguredRemoteRepository ( remoteRepository ) ; final Project project = new Project ( ) ; dependenciesTask . setProject ( project ) ; for ( DependencyJar dependencyJar : dependencies ) { Dependency dependency = new Dependency ( ) ; dependency . setArtifactId ( dependencyJar . getArtifactId ( ) ) ; dependency . setGroupId ( dependencyJar . getGroupId ( ) ) ; dependency . setType ( dependencyJar . getType ( ) ) ; dependency . setVersion ( dependencyJar . getVersion ( ) ) ; if ( dependencyJar . getClassifier ( ) != null ) { dependency . setClassifier ( dependencyJar . getClassifier ( ) ) ; } dependenciesTask . addDependency ( dependency ) ; } whileLocked ( dependenciesTask :: execute ) ; @ SuppressWarnings ( "unchecked" ) Hashtable < String , String > artifacts = project . getProperties ( ) ; URL [ ] urls = new URL [ dependencies . length ] ; for ( int i = 0 ; i < urls . length ; i ++ ) { try { urls [ i ] = Paths . get ( artifacts . get ( key ( dependencies [ i ] ) ) ) . toUri ( ) . toURL ( ) ; } catch ( MalformedURLException e ) { throw new RuntimeException ( e ) ; } } return urls ; }
Get an array of local artifact URLs for the given dependencies. The order of the URLs is guaranteed to be the
same as the input order of dependencies, i.e., urls[i] is the local artifact URL for dependencies[i].
Get an array of local artifact URLs for the given dependencies . The order of the URLs is guaranteed to be the same as the input order of dependencies i . e . urls [ i ] is the local artifact URL for dependencies [ i ] .