private void addRelevantProjectDependenciesToClasspath(Set<URL> path) throws MojoExecutionException {
        if (this.includeProjectDependencies) {
            try {
                getLog().debug("Project Dependencies will be included.");

                URL mainClasses = new File(project.getBuild().getOutputDirectory()).toURI().toURL();
                getLog().debug("Adding to classpath : " + mainClasses);
                path.add(mainClasses);

                Set<Artifact> dependencies = CastUtils.cast(project.getArtifacts());

                // system scope dependencies are not returned by maven 2.0. See
                // MEXEC-17
                dependencies.addAll(getAllNonTestScopedDependencies());

                Iterator<Artifact> iter = dependencies.iterator();
                while (iter.hasNext()) {
                    Artifact classPathElement = iter.next();
                    getLog().debug("Adding project dependency artifact: " + classPathElement.getArtifactId()
                        + " to classpath");
                    File file = classPathElement.getFile();
                    if (file != null) {
                        path.add(file.toURI().toURL());
                    }
                }

            } catch (MalformedURLException e) {
                throw new MojoExecutionException("Error during setting up classpath", e);
            }
        } else {
            getLog().debug("Project Dependencies will be excluded.");
        }

    }
private void addRelevantProjectDependenciesToClasspath ( Set < URL > path ) throws MojoExecutionException { if ( this . includeProjectDependencies ) { try { getLog ( ) . debug ( "Project Dependencies will be included." ) ; URL mainClasses = new File ( project . getBuild ( ) . getOutputDirectory ( ) ) . toURI ( ) . toURL ( ) ; getLog ( ) . debug ( "Adding to classpath : " + mainClasses ) ; path . add ( mainClasses ) ; Set < Artifact > dependencies = CastUtils . cast ( project . getArtifacts ( ) ) ; dependencies . addAll ( getAllNonTestScopedDependencies ( ) ) ; Iterator < Artifact > iter = dependencies . iterator ( ) ; while ( iter . hasNext ( ) ) { Artifact classPathElement = iter . next ( ) ; getLog ( ) . debug ( "Adding project dependency artifact: " + classPathElement . getArtifactId ( ) + " to classpath" ) ; File file = classPathElement . getFile ( ) ; if ( file != null ) { path . add ( file . toURI ( ) . toURL ( ) ) ; } } } catch ( MalformedURLException e ) { throw new MojoExecutionException ( "Error during setting up classpath" , e ) ; } } else { getLog ( ) . debug ( "Project Dependencies will be excluded." ) ; } }
Add any relevant project dependencies to the classpath. Takes
includeProjectDependencies into consideration.

@param path classpath of {@link java.net.URL} objects
@throws MojoExecutionException