code: protected Artifact resolveArtifact(final Artifact artifact, final boolean transitive) throws MojoExecutionException {
          assert artifact != null;
  
          try {
              if (transitive) {
                  artifactResolver.resolveTransitively(
                          Collections.singleton(artifact),
                          project.getArtifact(),
                          project.getRemoteArtifactRepositories(),
                          artifactRepository,
                          artifactMetadataSource);
              }
              else {
                  artifactResolver.resolve(
                          artifact,
                          project.getRemoteArtifactRepositories(),
                          artifactRepository);
              }
          }
          catch (ArtifactResolutionException e) {
              throw new MojoExecutionException("Unable to resolve artifact", e);
          }
          catch (ArtifactNotFoundException e) {
              throw new MojoExecutionException("Unable to find artifact", e);
          }
  
          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 artifact      The artifact to be resolved; must not be null
  @param transitive    True to resolve the artifact transitively
  @return              The resolved artifact; never null
  
  @throws MojoExecutionException   Failed to resolve artifact