ldap-maven-plugin/src/main/java/com/btmatthews/maven/plugins/ldap/mojo/IncludeServerDependenciesComponentConfigurator.java
private Collection<Artifact> getServerDependencies(final String serverType,
                                                       final ExpressionEvaluator expressionEvaluator)
            throws ComponentConfigurationException {
        try {
            final MavenProject project = (MavenProject) expressionEvaluator.evaluate("${project}");
            final String localRepo = (String) expressionEvaluator.evaluate("${settings.localRepository}");
            final ArtifactRepository localRepository = repositorySystem.createLocalRepository(new File(localRepo));
            final RepositoryRequest repositoryRequest = new DefaultRepositoryRequest();
            repositoryRequest.setRemoteRepositories(project.getRemoteArtifactRepositories());
            repositoryRequest.setLocalRepository(localRepository);
            final ArtifactResolutionRequest request = new ArtifactResolutionRequest(repositoryRequest);
            request.setArtifact(getServerArtifact(serverType));
            request.setResolveTransitively(true);
            final ArtifactResolutionResult result = repositorySystem.resolve(request);
            if (result.isSuccess()) {
                return result.getArtifacts();
            }
            boolean first = true;
            final StringBuilder builder = new StringBuilder("Cannot resolve dependencies: [");
            for (final Artifact artifact : result.getMissingArtifacts()) {
                if (!first) {
                    builder.append(',');
                } else {
                    first = false;
                }
                builder.append(artifact.getGroupId());
                builder.append(':');
                builder.append(artifact.getArtifactId());
                builder.append(':');
                builder.append(artifact.getVersion());
            }
            builder.append("]");
            throw new ComponentConfigurationException(builder.toString());
        } catch (final ExpressionEvaluationException e) {
            throw new ComponentConfigurationException("Error evaluating expression", e);
        } catch (final InvalidRepositoryException e) {
            throw new ComponentConfigurationException("Error resolving local repository", e);
        }
    }
private Collection<Artifact> getServerDependencies(final String serverType,
                                                       final ExpressionEvaluator expressionEvaluator)
            throws ComponentConfigurationException {
        try {
            final MavenProject project = (MavenProject) expressionEvaluator.evaluate("${project}");
            final String localRepo = (String) expressionEvaluator.evaluate("${settings.localRepository}");
            final ArtifactRepository localRepository = repositorySystem.createLocalRepository(new File(localRepo));
            final RepositoryRequest repositoryRequest = new DefaultRepositoryRequest();
            repositoryRequest.setRemoteRepositories(project.getRemoteArtifactRepositories());
            repositoryRequest.setLocalRepository(localRepository);
            final ArtifactResolutionRequest request = new ArtifactResolutionRequest(repositoryRequest);
            request.setArtifact(getServerArtifact(serverType));
            request.setResolveTransitively(true);
            final ArtifactResolutionResult result = repositorySystem.resolve(request);
            if (result.isSuccess()) {
                return result.getArtifacts();
            }
            boolean first = true;
            final StringBuilder builder = new StringBuilder("Cannot resolve dependencies: [");
            for (final Artifact artifact : result.getMissingArtifacts()) {
                if (!first) {
                    builder.append(',');
                } else {
                    first = false;
                }
                builder.append(artifact.getGroupId());
                builder.append(':');
                builder.append(artifact.getArtifactId());
                builder.append(':');
                builder.append(artifact.getVersion());
            }
            builder.append("]");
            throw new ComponentConfigurationException(builder.toString());
        } catch (final ExpressionEvaluationException e) {
            throw new ComponentConfigurationException("Error evaluating expression", e);
        } catch (final InvalidRepositoryException e) {
            throw new ComponentConfigurationException("Error resolving local repository", e);
        }
    }
private Collection < Artifact > getServerDependencies ( final String serverType , final ExpressionEvaluator expressionEvaluator ) throws ComponentConfigurationException { try { final MavenProject project = ( MavenProject ) expressionEvaluator . evaluate ( "${project}" ) ; final String localRepo = ( String ) expressionEvaluator . evaluate ( "${settings.localRepository}" ) ; final ArtifactRepository localRepository = repositorySystem . createLocalRepository ( new File ( localRepo ) ) ; final RepositoryRequest repositoryRequest = new DefaultRepositoryRequest ( ) ; repositoryRequest . setRemoteRepositories ( project . getRemoteArtifactRepositories ( ) ) ; repositoryRequest . setLocalRepository ( localRepository ) ; final ArtifactResolutionRequest request = new ArtifactResolutionRequest ( repositoryRequest ) ; request . setArtifact ( getServerArtifact ( serverType ) ) ; request . setResolveTransitively ( true ) ; final ArtifactResolutionResult result = repositorySystem . resolve ( request ) ; if ( result . isSuccess ( ) ) { return result . getArtifacts ( ) ; } boolean first = true ; final StringBuilder builder = new StringBuilder ( "Cannot resolve dependencies: [" ) ; for ( final Artifact artifact : result . getMissingArtifacts ( ) ) { if ( ! first ) { builder . append ( ' ' ) ; } else { first = false ; } builder . append ( artifact . getGroupId ( ) ) ; builder . append ( ' ' ) ; builder . append ( artifact . getArtifactId ( ) ) ; builder . append ( ' ' ) ; builder . append ( artifact . getVersion ( ) ) ; } builder . append ( "]" ) ; throw new ComponentConfigurationException ( builder . toString ( ) ) ; } catch ( final ExpressionEvaluationException e ) { throw new ComponentConfigurationException ( "Error evaluating expression" , e ) ; } catch ( final InvalidRepositoryException e ) { throw new ComponentConfigurationException ( "Error resolving local repository" , e ) ; } }
Resolve the LDAP server type artifact and its dependencies.

@param serverType          The LDAP server type.
@param expressionEvaluator Used to get the Maven project model and repository session objects.
@return A list of dependencies required for the LDAP server type.
@throws ComponentConfigurationException If the was a problem resolving the dependencies for
the LDAP server type.
Resolve the LDAP server type artifact and its dependencies .