src/main/java/org/codehaus/mojo/exec/ExecJavaMojo.java
private Set<Artifact> resolveExecutableDependencies( Artifact executablePomArtifact )
        throws MojoExecutionException
    {

        Set<Artifact> executableDependencies = new LinkedHashSet<>();
        try
        {
            ProjectBuildingRequest buildingRequest = getSession().getProjectBuildingRequest();
            
            MavenProject executableProject =
                this.projectBuilder.build( executablePomArtifact, buildingRequest ).getProject();

            for ( ArtifactResult artifactResult : dependencyResolver.resolveDependencies( buildingRequest, executableProject.getModel(), null ) )
            {
                executableDependencies.add( artifactResult.getArtifact() );
            }
        }
        catch ( Exception ex )
        {
            throw new MojoExecutionException( "Encountered problems resolving dependencies of the executable "
                + "in preparation for its execution.", ex );
        }

        return executableDependencies;
    }
private Set<Artifact> resolveExecutableDependencies( Artifact executablePomArtifact )
        throws MojoExecutionException
    {

        Set<Artifact> executableDependencies = new LinkedHashSet<>();
        try
        {
            ProjectBuildingRequest buildingRequest = getSession().getProjectBuildingRequest();
            
            MavenProject executableProject =
                this.projectBuilder.build( executablePomArtifact, buildingRequest ).getProject();

            for ( ArtifactResult artifactResult : dependencyResolver.resolveDependencies( buildingRequest, executableProject.getModel(), null ) )
            {
                executableDependencies.add( artifactResult.getArtifact() );
            }
        }
        catch ( Exception ex )
        {
            throw new MojoExecutionException( "Encountered problems resolving dependencies of the executable "
                + "in preparation for its execution.", ex );
        }

        return executableDependencies;
    }
Resolve the executable dependencies for the specified project

@param executablePomArtifact the project's POM
@return a set of Artifacts
@throws MojoExecutionException if a failure happens