Start with specifying the artifactId
779240
public static Artifact withArtifactId(String artifactId)
    {
        Artifact artifact = new Artifact();
        artifact.artifactId = new RegexParameterizedPatternParser(artifactId);
        return artifact;
    }
390711
def _MigrateArtifact(artifact):
  """"""
  name = Text(artifact.name)

  try:
    logging.info("Migating %s", name)
    data_store.REL_DB.WriteArtifact(artifact)
    logging.info("  Wrote %s", name)
  except db.DuplicatedArtifactError:
    logging.info("  Skipped %s, because artifact already exists.", name)
352881
public static void setId(MavenArtifactDescriptor artifactDescriptor, Coordinates coordinates) {
        artifactDescriptor.setFullQualifiedName(MavenArtifactHelper.getId(coordinates));
    }
960871
public ArchiveCoordinateModel getSingleOrCreate(String groupId, String artifactId, String version)
    {
        ArchiveCoordinateModel archive = findSingle(groupId, artifactId, version);
        if (archive != null)
            return archive;
        else
            return create().setGroupId(groupId).setArtifactId(artifactId).setVersion(version);
    }
1102094
def add_candidate(self, artifact):
        
        self.candidates.append(artifact)
        self._log(logging.DEBUG, "CANDIDATES appended:'{}'"
                  .format(artifact))
564622
private void addNewArtifacts(List<ArtifactoryRepo> enabledRepos) {
        long start = System.currentTimeMillis();

        int count = 0;
        for (ArtifactoryRepo repo : enabledRepos) {
            for (BinaryArtifact artifact : nullSafe(artifactoryClient.getArtifacts(repo.getInstanceUrl(), repo.getRepoName(), repo.getLastUpdated()))) {
                if (artifact != null && isNewArtifact(repo, artifact)) {
                    artifact.setCollectorItemId(repo.getId());
                    binaryArtifactRepository.save(artifact);
                    count++;
                }
            }
        }

        // Iterate through list of repos and update the lastUpdated timestamp
        for (ArtifactoryRepo repo : enabledRepos) {
            repo.setLastUpdated(start);
        }
        // We set the last update time so need to save it
        artifactoryRepoRepository.save(enabledRepos);
        log("New artifacts", start, count);
    }
827277
def _link(self, base_dir: str, artifact_map: dict, conf: Config):
        """"""
        num_linked = 0
        for dst, src in artifact_map.items():
            abs_src = join(conf.project_root, src)
            abs_dest = join(conf.project_root, base_dir, dst)
            link_node(abs_src, abs_dest)
            num_linked += 1
        return num_linked
731950
def _generate_id(self):
        
        name = self.name.replace(self.special_separator, "-").replace(".", "-")
        loc = "\/"
        if self.location:
            loc = self.location
        _id = "{PREFIX}{SEP}{NAME}{HASH}{SEP}".format(
            PREFIX=constants.CONU_ARTIFACT_TAG,
            NAME=name,
            HASH=hashlib.sha512(loc).hexdigest()[: 10],
            SEP=self.special_separator
        )
        return _id
1147272
function determineArtifactName( generator ) {
   if( generator.name ) {
      return generator.name;
   }
   if( generator.env.cwd !== generator.destinationRoot() && generator.options.directory.length === 0) {
      var artifactPath = path.relative( generator.destinationRoot(), generator.env.cwd );
      return path.basename( artifactPath );
   }
   return '';
}
779878
private static String initializeBaseDir() {
        LOGGER.entering();
        String repoFolderName = System.getProperty(ARTIFACT_BASE_CONFIG_PROPERTY,
                ConfigParser.parse().getString(ARTIFACT_BASE_CONFIG_PROPERTY, "repository"));
        repoFolderName = StringUtils.defaultIfEmpty(repoFolderName, "repository");
        LOGGER.exiting(repoFolderName);
        return repoFolderName;
    }
747773
private Artifact getResolvedArtifact( String groupId, String artifactId, String version )
        throws ArtifactNotFoundException, ArtifactResolutionException
    {
        Artifact artifact = factory.createArtifact( groupId, artifactId, version, Artifact.SCOPE_RUNTIME, "jar" );
        resolver.resolve( artifact, remoteRepos, localRepo );
        return artifact;
    }
1105418
def stop_artifact_creation(self, id_or_uri, task_uri):
        
        data = {
            "taskUri": task_uri
        }

        uri = self.URI + '/' + extract_id_from_uri(id_or_uri) + self.STOP_CREATION_PATH

        return self._client.update(data, uri=uri)
398192
public static final void suggestDependency(String groupId, String artifactId, String version) {
		System.err.println("It looks like you are missing some dependencies! Maven dependency:");
		System.err.println();
		System.err.println("<dependency>");
		System.err.println("    <groupId>" + groupId + "</groupId>");
		System.err.println("    <artifactId>" + artifactId + "</artifactId>");
		System.err.println("    <version>" + version + "</version>");
		System.err.println("</dependency>");
		System.err.println();
		System.err.println("Gradle dependency:");
		System.err.println();
		System.err.println("compile group: '" + groupId + "', name: '" + artifactId + "', version: '" + version + "'");
		System.err.println();
		System.err.println(
				"...or download the JAR from https://mvnrepository.com/artifact/" + groupId + "/" + artifactId);
		System.err.println();
	}
974749
def _copy_artifact(self, tgt, jar, version, typename, suffix='', extension='jar',
                     artifact_ext='', override_name=None):
    """"""
    genmap = self.context.products.get(typename)
    product_mapping = genmap.get(tgt)
    if product_mapping is None:
      raise ValueError("No product mapping in {} for {}. "
                       "You may need to run some other task first".format(typename, tgt))
    for basedir, jars in product_mapping.items():
      for artifact in jars:
        path = self.artifact_path(jar, version, name=override_name, suffix=suffix,
                                  extension=extension, artifact_ext=artifact_ext)
        safe_mkdir(os.path.dirname(path))
        shutil.copy(os.path.join(basedir, artifact), path)
179311
protected void addToClassPath(Iterable<ArtifactContainer> artifacts) {

        for (ArtifactContainer art : artifacts) {
            smartClassPath.addArtifactContainer(art);
        }
    }
12212
def register_target_artifact_metadata(self, target: str, metadata: dict):
        """"""
        with self.context_lock:
            self.artifacts_metadata[target.name] = metadata
1217687
def RegisterArtifact(self,
                       artifact_rdfvalue,
                       source="datastore",
                       overwrite_if_exists=False,
                       overwrite_system_artifacts=False):
    """"""
    artifact_name = artifact_rdfvalue.name
    if artifact_name in self._artifacts:
      if not overwrite_if_exists:
        details = "artifact already exists and `overwrite_if_exists` is unset"
        raise rdf_artifacts.ArtifactDefinitionError(artifact_name, details)
      elif not overwrite_system_artifacts:
        artifact_obj = self._artifacts[artifact_name]
        if not artifact_obj.loaded_from.startswith("datastore:"):
          # This artifact was not uploaded to the datastore but came from a
          # file, refuse to overwrite.
          details = "system artifact cannot be overwritten"
          raise rdf_artifacts.ArtifactDefinitionError(artifact_name, details)

    # Preserve where the artifact was loaded from to help debugging.
    artifact_rdfvalue.loaded_from = source
    # Clear any stale errors.
    artifact_rdfvalue.error_message = None
    self._artifacts[artifact_rdfvalue.name] = artifact_rdfvalue