Skip to content

Commit

Permalink
Throw an exception if you try to use composite :provided profile.
Browse files Browse the repository at this point in the history
This is as close to a fix as we're likely to get for #2687
  • Loading branch information
technomancy committed Jul 9, 2020
1 parent b6db438 commit 8fb39db
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions doc/PROFILES.md
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,12 @@ This can be used to avoid duplication:
It is not recommended to make a composite profile which contains both
keywords and maps; they should either be all keywords or all maps.

Composite profiles also cannot have certain types of metadata
propagated, which makes them incompatible with the `:provided`
profile. If you get the error "Composite profiles are incompatible with :provided."
consider adding `^{:pom-scope :provided}` metadata to the profile map
which contains the dependencies instead.

## Dynamic Eval

Often you want to read an environment variable or execute a function to capture
Expand Down
3 changes: 3 additions & 0 deletions leiningen-core/src/leiningen/core/project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,9 @@
:production :system :repl}
profile))
(warn "Warning: profile" profile "not found."))
(when (and (= :provided profile) (composite-profile? result))
(throw (Exception.
"Composite profiles are incompatible with :provided.")))
(lookup-profile* profiles result))

(composite-profile? profile)
Expand Down

0 comments on commit 8fb39db

Please sign in to comment.