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 .