leiningen

N.B. The maintainers are on #leiningen on Libera chat IRC. Go there for direct support/bug reports.
mafcocinco 2019-08-15T19:41:09.072600Z

This is probably a pretty newb question but is there a way/best practice for deploying a Leiningen template to a private JAR server. My company is using <http://deps.co|deps.co> to deploy a couple of shared Clojure libs, which works great. Accessing this is dependent on having a :repositories key in the project.clj of the project that is using the shared lib. In the case of a Leiningen template, there is no project.clj file in which to put the repositories information. Is this something that should be handled via ~/.lein/profiles.clj?

2019-08-15T20:01:27.074700Z

Guys I'm using lein pedestal uberwar, I have many folders under src and I want to have the folder class by profile. Like

src/backend/a
src/backend/b
src/common/
when I use:
lein with-profile a pedestal uberwar
This will only generate a jar that has class a

2019-08-15T20:01:48.075100Z

how can I do this?

2019-08-15T20:08:42.075500Z

@d.ian.b I can’t follow what you are trying to do well enough to help there

2019-08-16T14:31:14.089300Z

I've changed some stuff here and made a folder named commons

2019-08-16T14:31:25.089500Z

i'm having this problem when i run

2019-08-16T14:31:36.089700Z

Could not locate user/core__init.class, user/core.clj or user/core.cljc on classpath.

2019-08-16T14:32:13.089900Z

I think its better to have 2 folders src/commons and src/user

2019-08-16T14:36:25.090100Z

for project.clj I have ... :source-paths ["src/commons"] :profiles {:user {:source-paths ["src/user"] ....}

2019-08-16T14:43:47.090300Z

your last example makes sense

2019-08-16T14:44:07.090500Z

if you put a top level :source-paths in the project it’ll automatically merge to the profiles :source-paths if you do not put the :replace metadata

2019-08-16T14:44:10.090700Z

so that should give you what you want

2019-08-15T20:08:50.075900Z

perhaps state it different or show an example project.clj?

2019-08-15T20:09:19.076500Z

@mafcocinco I think you’re wanting to have a shared :repositories coming from ~/.lein/profiles.clj? I don’t think it’s recommended at least and will likely give you warnings. Why can’t you put the :repositories into your build project? The template can’t have it in it? I think I don’t understand that either hah.

2019-08-15T20:13:21.079700Z

and I want to have jar that does not has propose stuff only user stuff

2019-08-15T20:13:47.079900Z

because it were separated repos before

2019-08-15T20:15:23.080200Z

(defproject backend "0.1.1"
  :dependencies [[org.clojure/clojure "1.10.1"]
                 [com.walmartlabs/lacinia-pedestal "0.11.0"]
                 [buddy "2.0.0"]
                 [prismatic/schema "1.1.11"]
                 [buddy/buddy-hashers "1.4.0"]
                 [com.google.cloud/google-cloud-datastore "1.85.0"]
                 [com.google.appengine/appengine-api-1.0-sdk "1.9.76"]
                 [com.google.cloud/google-cloud-vision "1.69.0"]
                 [com.google.appengine.tools/appengine-gcs-client "0.8"]
                 [com.rpl/specter "1.1.2"]
                 [http-kit "2.3.0"]
                 [clj-time "0.15.1"]
                 [com.twilio.sdk/twilio "7.41.0"]
                 [camel-snake-kebab "0.4.0"]
                 [metosin/jsonista "0.2.3"]
                 [com.walmartlabs/lacinia "0.31.0"]
                 [camel-snake-kebab "0.4.0"]
                 [base64-clj "0.1.1"]
                 [clojurewerkz/money "1.10.0"]
                 [environ "1.1.0"]
                 [org.clojure/data.xml "0.2.0-alpha6"]]
  :plugins [[ohpauleez/lein-pedestal "0.1.0-beta10"]
            [lein-environ "1.1.0"]]
  :resource-paths ["resources"]
  :source-paths ["src" "src/commons"]
  :profiles {:production {:env {:crowd-env         "production"
                                :clojure-repl      "false"
                                :datastore-offline "false"}}
             :homolog    {:env {:crowd-env         "homolog"
                                :clojure-repl      "false"
                                :datastore-offline "false"}}
             :dev        {:resource-paths ["test/backend/"]
                          :plugins        [[lein-midje "3.2.1"]]
                          :dependencies   [[midje "1.9.9"]
                                           [org.clojure/test.check "0.9.0"]
                                           [com.gfredericks/test.chuck "0.2.9"]
                                           [talltale "0.4.3"]
                                           [com.wsscode/pathom  "2.2.19"]]
                          :env            {:crowd-env         "develop"
                                           :clojure-repl      "true"
                                           :datastore-offline "true"}}
              :user       {:dependencies [[org.clojure/java.jdbc "0.7.9"]]
                              :env            {:module "user"}
                              :source-paths   ["src/backend/user"]
                              :resource-paths ["resources/user"]
                              :main           backend.user.core
                              :aot            [backend.user.core]
                              :pedestal       {:server-ns "backend.user.core"}}
              :propose    {:env            {:module "propose"}
                                  :main           backend.propose.core
                                  :source-paths   ["src/backend/propose"]
                                  :resource-paths ["resources/propose"]
                                  :aot            [backend.propose.core]
                                  :pedestal       {:server-ns "backend.propose.core"}}})
mine project.clj

2019-08-15T20:15:44.080400Z

mine filetree

├── backend
│   ├── propose
│   │   ├── core.clj
│   │   ├── datastore.clj
│   │   ├── push.clj
│   │   ├── query.clj
│   │   ├── resolvers.clj
│   │   └── twilio.clj
│   └── user
│       ├── core.clj
│       ├── mssql.clj
│       ├── query.clj
│       └── resolvers.clj
└── commons
    ├── datastore.clj
    ├── datastore_schema.clj
    ├── env.clj
    ├── twilio.clj
    └── twilio_schema.clj

2019-08-15T20:46:49.080800Z

ok I see

2019-08-15T20:46:56.081Z

you are inheriting the "src" dir in all profiles

2019-08-15T20:46:59.081200Z

for :source-paths

2019-08-15T21:11:02.081400Z

so for example

2019-08-15T21:11:36.081600Z

:user       {:dependencies [[org.clojure/java.jdbc "0.7.9"]]
             :env            {:module "user"}
             :source-paths   ^:replace ["src/backend/user"]
             :resource-paths ["resources/user"]
             :main           backend.user.core
             :aot            [backend.user.core]
             :pedestal       {:server-ns "backend.user.core"}}
added :replace metadata to the :source-paths in the :user profile

2019-08-15T21:12:18.081800Z

Similar for :resource-paths if you need isolation there as well

❤️ 1