code: protected int addClasspathElements( Collection<?> elements, URL[] urls, int startPosition )
          throws MojoExecutionException
      {
          for ( Object object : elements )
          {
              try
              {
                  if ( object instanceof Artifact )
                  {
                      urls[startPosition] = ( (Artifact) object ).getFile().toURI().toURL();
                  }
                  else if ( object instanceof Resource )
                  {
                      urls[startPosition] = new File( ( (Resource) object ).getDirectory() ).toURI().toURL();
                  }
                  else
                  {
                      urls[startPosition] = new File( (String) object ).toURI().toURL();
                  }
              }
              catch ( MalformedURLException e )
              {
                  throw new MojoExecutionException(
                                                    "Failed to convert original classpath element " + object + " to URL.",
                                                    e );
              }
              startPosition++;
          }
          return startPosition;
      }
docs: Add classpath elements to a classpath URL set
  
  @param elements the initial URL set
  @param urls the urls to add
  @param startPosition the position to insert URLS
  @return full classpath URL set
  @throws MojoExecutionException some error occured