$ cd apps/
$ cd phx_targets_test/
$ mix deps.get --target postgres
Phoenix Targets: :host
warning: the dependency :phoenix_ecto is duplicated at the top level, please remove one of them
Resolving Hex dependencies...
Dependency resolution completed:
New:
...
phoenix_ecto 4.0.0
...
postgrex 0.14.1
...
phx_targets_test deps.tree --target postgres
$ mix deps.tree --target postgres
Phoenix Targets: :host
warning: the dependency :phoenix_ecto is duplicated at the top level, please remove one of them
warning: the dependency :phoenix_ecto is duplicated at the top level, please remove one of them
phx_targets_test
...
├── postgrex >= 0.0.0 (Hex package)
│ ├── connection ~> 1.0 (Hex package)
│ ├── db_connection ~> 2.0 (Hex package)
│ │ └── connection ~> 1.0.2 (Hex package)
│ ├── decimal ~> 1.5 (Hex package)
│ └── jason ~> 1.0 (Hex package)
...
└── phoenix_ecto ~> 4.0 (Hex package)
├── ecto ~> 3.0 (Hex package)
├── phoenix_html ~> 2.9 (Hex package)
└── plug ~> 1.0 (Hex package)
phx_targets_test deps.get MIX_TARGET=postgres
$ MIX_TARGET=postgres mix deps.get
Phoenix Targets: :postgres
warning: the dependency :phoenix_ecto is duplicated at the top level, please remove one of them
Resolving Hex dependencies...
Failed to use "ecto" (version 3.0.7) because
absinthe_ecto (version 0.1.3) requires >= 0.0.0
ecto_sql (version 3.0.5) requires ~> 3.0.6
mssql_ecto (version 1.2.0) requires ~> 2.2.0
phoenix_ecto (version 4.0.0) requires ~> 3.0
mix.lock specifies 3.0.7
** (Mix) Hex dependency resolution failed, change the version requirements of your dependencies or unlock them (by using mix deps.update or mix deps.unlock). If you are unable to resolve the conflicts you can try overriding with {:dependency, "~> 1.0", override: true}
About
Introduce `Mix.target` test - https://github.com/elixir-lang/elixir/issues/8063