-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Description
Describe the bug
:pom-addition in profiles, invoked via :classifiers doesn't affect pom.properties in classified jar files.
To Reproduce
Here's a test case project.clj:
(defproject lein-classifier-pom-addition-bug "0.1.0-SNAPSHOT"
:dependencies [[org.clojure/clojure "1.10.1"]]
:classifiers [["solr6" :solr6]
["solr7" :solr7]
["solr8" :solr8]]
:profiles {:solr6 {:pom-addition [:properties ["solrj.major.version" "6"]]}
:solr7 {:pom-addition [:properties ["solrj.major.version" "7"]]}
:solr8 {:pom-addition [:properties ["solrj.major.version" "8"]]}}
:repl-options {:init-ns lein-bug.core})
- Run "lein jar"
- Examine the pom.properties files embedded into the output jar file in each of the solr6, solr7, and solr8 subdirectories of target.
- The solrj.major.version property will not be in those files.
Actual behavior
:pom-addition from profiles is not used.
Expected behavior
:pom-addition from profiles should be used, potentially merged with :pom-addition at the top-level of the project (where it may be needed to override pom content, such as reporting).
Environment
- Leiningen Version: 2.9.4.
- Leiningen installation method: lein script
- JDK Version: 1.8
- OS: Debian stretch
- Anything else that might be relevant to your problem?
Tried adding ^:leaky to the profile metadata, but no difference.
The need here stems from having to support multiple versions of SolrJ in the clojure-solr fork I've been maintaining for a number of years. The library is built with classifiers for account for different SolrJ major versions. To try to obscure some breaking changes between versions 6, 7 and 8, the Clojure library attempts to figure out which SolrJ version it's been compiled against. In test code, it can do this by reading the manifest.mf file for EmbeddedSolrServer, but that doesn't get included into Clojure uberjars built against the clojure-solr library. But clojure-solr's pom.properties does appear in the uberjar, so I thought it would work to write the major version into that file via :pom-addition and read it at runtime. But I can't figure out how to write different values into pom.properties for different Solr versions.