code: @Override
      protected Artifact getArtifact(final ArtifactItem item) throws MojoExecutionException {
          assert item != null;
          Artifact artifact = null;
          
          if (item.getVersion() != null) {
              // if version is set in ArtifactItem, it will always override the one in project dependency
              artifact = createArtifact(item);
          } else {
              // Return the artifact from the project dependency if it is available and the mojo
              // should have requiresDependencyResolution=ResolutionScope.COMPILE_PLUS_RUNTIME set
              artifact = resolveFromProjectDependencies(item);
              
              if (artifact != null) {
                  // in case it is not resolved yet
                  if (!artifact.isResolved()) {
                      item.setVersion(artifact.getVersion());
                      artifact = createArtifact(item);
                  }
              } else if (resolveFromProjectDepMgmt(item) != null) {
                  // if item has no version set, try to get it from the project dependencyManagement section
                  // get version from dependencyManagement
                  item.setVersion(resolveFromProjectDepMgmt(item).getVersion());
                  artifact = createArtifact(item);
              } else {
                      throw new MojoExecutionException(
                              "Unable to find artifact version of " + item.getGroupId() + ":" + item.getArtifactId()
                                      + " in either project dependencies or in project dependencyManagement.");
              }
          }
          
          return artifact;
      }
docs: Resolves the Artifact from the remote repository if necessary. If no version is specified, it will
  be retrieved from the dependency list or from the DependencyManagement section of the pom.
  
  
  @param item  The item to create an artifact for; must not be null
  @return      The artifact for the given item
  
  @throws MojoExecutionException   Failed to create artifact