protected List getProjectClasspathElements() throws DependencyResolutionRequiredException {
        Set results = new LinkedHashSet();

        Set includes = getClasspathIncludes();

        if (includes.contains(CLASSPATH_INCLUDE_ALL) || includes.contains(CLASSPATH_INCLUDE_RUNTIME)) {
            for (Iterator i = project.getRuntimeClasspathElements().iterator(); i.hasNext();) {
                String fileName = (String) i.next();
                try {
                    results.add(new File(fileName).getCanonicalPath());
                }
                catch (IOException e) {
                    throw new RuntimeException("Classpath element not found: " + fileName, e);
                }
            }
        }

        if (includes.contains(CLASSPATH_INCLUDE_ALL) || includes.contains(CLASSPATH_INCLUDE_ARTIFACTS)) {
            for (Iterator i = project.getArtifacts().iterator(); i.hasNext();) {
                Artifact artifact = (Artifact) i.next();
                if (artifact.getType().equals("jar") && artifact.getClassifier() == null) {
                    try {
                        results.add(artifact.getFile().getCanonicalPath());
                    }
                    catch (IOException e) {
                        throw new RuntimeException("Maven artifact file not found: " + artifact, e);
                    }
                }
            }
        }

        if (includes.contains(CLASSPATH_INCLUDE_ALL) || includes.contains(CLASSPATH_INCLUDE_PLUGINS)) {
            for (Iterator i = pluginArtifacts.iterator(); i.hasNext();) {
                Artifact artifact = (Artifact) i.next();
                if (artifact.getType().equals("jar") && artifact.getClassifier() == null) {
                    try {
                        results.add(artifact.getFile().getCanonicalPath());
                    }
                    catch (IOException e) {
                        throw new RuntimeException("Maven plugin-artifact file not found: " + artifact, e);
                    }
                }
            }
        }

        return new ArrayList(results);
    }
protected List getProjectClasspathElements ( ) throws DependencyResolutionRequiredException { Set results = new LinkedHashSet ( ) ; Set includes = getClasspathIncludes ( ) ; if ( includes . contains ( CLASSPATH_INCLUDE_ALL ) || includes . contains ( CLASSPATH_INCLUDE_RUNTIME ) ) { for ( Iterator i = project . getRuntimeClasspathElements ( ) . iterator ( ) ; i . hasNext ( ) ; ) { String fileName = ( String ) i . next ( ) ; try { results . add ( new File ( fileName ) . getCanonicalPath ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( "Classpath element not found: " + fileName , e ) ; } } } if ( includes . contains ( CLASSPATH_INCLUDE_ALL ) || includes . contains ( CLASSPATH_INCLUDE_ARTIFACTS ) ) { for ( Iterator i = project . getArtifacts ( ) . iterator ( ) ; i . hasNext ( ) ; ) { Artifact artifact = ( Artifact ) i . next ( ) ; if ( artifact . getType ( ) . equals ( "jar" ) && artifact . getClassifier ( ) == null ) { try { results . add ( artifact . getFile ( ) . getCanonicalPath ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( "Maven artifact file not found: " + artifact , e ) ; } } } } if ( includes . contains ( CLASSPATH_INCLUDE_ALL ) || includes . contains ( CLASSPATH_INCLUDE_PLUGINS ) ) { for ( Iterator i = pluginArtifacts . iterator ( ) ; i . hasNext ( ) ; ) { Artifact artifact = ( Artifact ) i . next ( ) ; if ( artifact . getType ( ) . equals ( "jar" ) && artifact . getClassifier ( ) == null ) { try { results . add ( artifact . getFile ( ) . getCanonicalPath ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( "Maven plugin-artifact file not found: " + artifact , e ) ; } } } } return new ArrayList ( results ) ; }
Allow the script to work with every JAR dependency of both the project and plugin, including
optional and provided dependencies. Runtime classpath elements are loaded first, so that
legacy behavior is not modified.  Additional elements are added first in the order of
project artifacts, then in the order of plugin artifacts.