# File lib/buildr/packaging/artifact_namespace.rb, line 657
    def use(*specs)
      named = specs.flatten.inject({}) do |seen, spec|
        if Hash === spec && (spec.keys & ActsAsArtifact::ARTIFACT_ATTRIBUTES).empty?
          spec.each_pair do |name, spec|
            if ArtifactNamespace === spec # create as subnamespace
              raise ArgumentError.new("Circular reference") if self == spec
              registry[name.to_sym] = spec
            elsif Numeric === spec || (String === spec && VersionRequirement.version?(spec))
              artifact = ArtifactRequirement.allocate
              artifact.name = name
              artifact.version = spec.to_s
              seen[artifact.name] ||= artifact
            elsif Symbol === spec
              self.alias name, spec
            elsif Array === spec # a group
              seen[name] ||= spec.map { |s| ArtifactRequirement.new(s) }
            else
              artifact = ArtifactRequirement.new(spec)
              artifact.name = name
              seen[artifact.name] ||= artifact
            end
          end
        else
          if Symbol === spec
            artifact = get(spec).dclone
          else
            artifact = ArtifactRequirement.new(spec)
          end
          seen[artifact.name] ||= artifact
        end
        seen
      end
      named.each_pair do |name, artifact|
        is_group = Array === artifact
        artifact = [artifact].flatten.map do |artifact|
          unvers = artifact.unversioned_spec
          previous = get(unvers, false) || get(name, false)
          if previous # have previous on current namespace
            if previous.requirement # we must satisfy the requirement
              unless unvers # we only have the version
                satisfied = previous.requirement.satisfied_by?(artifact.version)
              else
                satisfied = previous.satisfied_by?(artifact)
              end
              raise "Unsatisfied dependency #{previous} " +
                "not satisfied by #{artifact}" unless satisfied
              previous.version = artifact.version # OK, set new version
              artifact = previous # use the same object for aliases
            else # not a requirement, set the new values
              unless artifact.id == previous.id && name != previous.name
                previous.copy_attrs(artifact)
                artifact = previous
              end
            end
          else
            if unvers.nil? && # we only have the version
                (previous = get(unvers, true, false, false))
              version = artifact.version
              artifact.copy_attrs(previous)
              artifact.version = version
            end
            artifact.requirement = nil
          end
          artifact.selected!
        end
        artifact = artifact.first unless is_group
        if is_group
          names = artifact.map do |art|
            unv = art.unversioned_spec
            registry[unv] = art
            unv
          end
          group(name, *(names + [{:namespace => self}]))
        elsif artifact.id
          unvers = artifact.unversioned_spec
          registry[name] = artifact
          registry.alias unvers, name
        else
          registry[name] = artifact
        end
      end
      self
    end