public Set < Artifact > resolveDependencies ( String artifactId , boolean plugins ) throws MojoExecutionException { final Artifact pluginArtifact ; if ( plugins ) { pluginArtifact = getSession ( ) . getCurrentProject ( ) . getPluginArtifactMap ( ) . get ( artifactId ) ; } else { pluginArtifact = getSession ( ) . getCurrentProject ( ) . getArtifactMap ( ) . get ( artifactId ) ; } final ArtifactResolutionRequest request = new ArtifactResolutionRequest ( ) ; request . setResolveRoot ( false ) ; request . setResolveTransitively ( true ) ; request . setLocalRepository ( getSession ( ) . getLocalRepository ( ) ) ; request . setRemoteRepositories ( getSession ( ) . getCurrentProject ( ) . getRemoteArtifactRepositories ( ) ) ; request . setOffline ( getSession ( ) . isOffline ( ) ) ; request . setForceUpdate ( getSession ( ) . getRequest ( ) . isUpdateSnapshots ( ) ) ; request . setServers ( getSession ( ) . getRequest ( ) . getServers ( ) ) ; request . setMirrors ( getSession ( ) . getRequest ( ) . getMirrors ( ) ) ; request . setProxies ( getSession ( ) . getRequest ( ) . getProxies ( ) ) ; request . setArtifact ( pluginArtifact ) ; final ArtifactResolutionResult result = resolve ( request ) ; try { this . resolutionErrorHandler . throwErrors ( request , result ) ; } catch ( MultipleArtifactsNotFoundException e ) { final Collection < Artifact > missing = new HashSet <> ( e . getMissingArtifacts ( ) ) ; if ( ! missing . isEmpty ( ) ) { throw new MojoExecutionException ( e . getLocalizedMessage ( ) , e ) ; } } catch ( ArtifactResolutionException e ) { throw new MojoExecutionException ( e . getLocalizedMessage ( ) , e ) ; } return result . getArtifacts ( ) ; }
Replies the dependencies for the given artifact .