private File resolveArtifact ( ClusterConfiguration config ) throws ArtifactException , IOException { String flavour = config . getFlavour ( ) ; String version = config . getVersion ( ) ; String artifactId = getArtifactId ( flavour , version ) ; String classifier = getArtifactClassifier ( version ) ; String type = getArtifactType ( version ) ; ElasticsearchArtifact artifactReference = new ElasticsearchArtifact ( artifactId , version , classifier , type ) ; config . getLog ( ) . debug ( "Artifact ref: " + artifactReference ) ; PluginArtifactResolver artifactResolver = config . getArtifactResolver ( ) ; try { config . getLog ( ) . debug ( "Resolving artifact against the local maven repo (stage 1)" ) ; return artifactResolver . resolveArtifact ( artifactReference . getArtifactCoordinates ( ) ) ; } catch ( ArtifactException e ) { config . getLog ( ) . debug ( "Artifact not found; downloading and installing it" ) ; File tempFile = downloadArtifact ( artifactReference , config ) ; config . getLog ( ) . debug ( "Installing " + tempFile + " in the local maven repo" ) ; config . getArtifactInstaller ( ) . installArtifact ( artifactReference . getGroupId ( ) , artifactReference . getArtifactId ( ) , artifactReference . getVersion ( ) , artifactReference . getClassifier ( ) , artifactReference . getType ( ) , tempFile ) ; config . getLog ( ) . debug ( "Resolving artifact against the local maven repo (stage 2)" ) ; return artifactResolver . resolveArtifact ( artifactReference . getArtifactCoordinates ( ) ) ; } }
Resolve the artifact and return a file reference to the local file .