Resolve Hex Packages

JFrog Artifactory Documentation

Products
JFrog Artifactory
Content Type
User Guide

This topic describes how to resolve Hex packages using the mix.exs file.

Hex Local Repository

To resolve Hex packages using the mix.exs file:

To resolve dependencies from a Local Artifactory Hex repository that you added, add the package names, versions, and repository name to your mix.exs file:

defp deps do
[
  {:<PACKAGE_NAME>, "<PACKAGE_VERSION>", repo: "REPOSITORY_NAME"}
]

Where:

  • <PACKAGE_NAME>: Name of the package

  • <PACKAGE_VERSION>: Version of the package

  • <REPOSITORY_NAME>: Name of the repository

  • <HEX_ORGANIZATION_NAME>: Name of the organization

For example:

defp deps do
[
  {:jason, "1.4.4", repo: "hex-local"}
]

Run the command.

mix deps.get

You can also use JFrog Set me up to copy the snippet populated with your token and environment. For more information, see Use Artifactory Set Me Up for Configuring Package Manager Clients.

Hex Remote Repository

Artifactory supports the following options for resolving a Hex package from Remote repository:

  • Resolve from hex.pm

    • Public packages

      To resolve your public Hex dependencies, add the package names and versions to your mix.exs file:

      defp deps do
      [
        {:<PACKAGE_NAME>, "<PACKAGE_VERSION>"}
      ]

      For example:

      defp deps do
      [
        {:jason, "1.4.4"}
      ]

      Run the command.

      mix deps.get
    • Private packages (Organization)

      To resolve your hex dependencies from a private organization in hex.pm, add the package names, versions, and organization name to your mix.exs file:

      defp deps do
      [
        {:<PACKAGE_NAME>, "<PACKAGE_VERSION>", organization: "<HEX_ORGANIZATION_NAME>"}
      ]

      For example:

      defp deps do
      [
        {:jason, "1.4.4", repo: "hex-remote", , organization: "acme"}
      ]

      Run the command.

      mix deps.get
  • Resolve from a private Hex server

    To resolve your Hex dependencies from a private Hex server, add the package names, versions, and repository name to your mix.exs file:

    defp deps do
    [
      {:<PACKAGE_NAME>, "<PACKAGE_VERSION>", repo: "REPOSITORY_NAME"}
    ]

    For example:

    defp deps do
    [
      {:jason, "1.4.4", repo: "hex-remote"}
    ]

    Note

    Organizations are not supported in private Hex server.

    Run the command.

    mix deps.get

Hex Virtual Repository

Artifactory supports the following options for resolving a Hex package from Virtual repository:

  • Public packages

    To resolve your public Hex dependencies, add the package names and versions to your mix.exs file:

    defp deps do
    [
      {:<PACKAGE_NAME>, "<PACKAGE_VERSION>"}
    ]

    For example:

    defp deps do
    [
      {:jason, "1.4.4"}
    ]

    Run the command.

    mix deps.get
  • Private packages (Organization)

    To resolve your hex dependencies from a private organization in hex.pm, add the package names, versions, and organization name to your mix.exs file:

    defp deps do
    [
      {:<PACKAGE_NAME>, "<PACKAGE_VERSION>", organization: "<HEX_ORGANIZATION_NAME>"},
    ]

    For example:

    defp deps do
    [
      {:jason, "1.4.4", repo: "hex-remote", , organization: "acme"}
    ]

    Run the command.

    mix deps.get