Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate custom pom.properties on a profile-by-profile basis using classifiers #2751

Open
ejschoen opened this issue Jun 19, 2021 · 0 comments

Comments

@ejschoen
Copy link

ejschoen commented Jun 19, 2021

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})
  1. Run "lein jar"
  2. Examine the pom.properties files embedded into the output jar file in each of the solr6, solr7, and solr8 subdirectories of target.
  3. 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.

@technomancy technomancy changed the title Unable to generate custom pom.properties on a profile-by-profile basis using classifiers Generate custom pom.properties on a profile-by-profile basis using classifiers Apr 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants