protected Artifact createArtifact ( final ArtifactItem item ) throws MojoExecutionException { assert item != null ; if ( item . getVersion ( ) == null ) { fillMissingArtifactVersion ( item ) ; if ( item . getVersion ( ) == null ) { throw new MojoExecutionException ( "Unable to find artifact version of " + item . getGroupId ( ) + ":" + item . getArtifactId ( ) + " in either dependency list or in project's dependency management." ) ; } } // Convert the string version to a range VersionRange range ; try { range = VersionRange . createFromVersionSpec ( item . getVersion ( ) ) ; log . trace ( "Using version range: {}" , range ) ; } catch ( InvalidVersionSpecificationException e ) { throw new MojoExecutionException ( "Could not create range for version: " + item . getVersion ( ) , e ) ; } return artifactFactory . createDependencyArtifact ( item . getGroupId ( ) , item . getArtifactId ( ) , range , item . getType ( ) , item . getClassifier ( ) , Artifact . SCOPE_PROVIDED ) ; }
Create a new artifact . If no version is specified it will be retrieved from the dependency list or from the DependencyManagement section of the pom .