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
?
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 ahow can I do this?
@d.ian.b I can’t follow what you are trying to do well enough to help there
I've changed some stuff here and made a folder named commons
i'm having this problem when i run
Could not locate user/core__init.class, user/core.clj or user/core.cljc on classpath.
I think its better to have 2 folders src/commons and src/user
for project.clj I have ... :source-paths ["src/commons"] :profiles {:user {:source-paths ["src/user"] ....}
your last example makes sense
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
so that should give you what you want
perhaps state it different or show an example project.clj?
@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.
and I want to have jar that does not has propose stuff only user stuff
because it were separated repos before
(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.cljmine 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
ok I see
you are inheriting the "src"
dir in all profiles
for :source-paths
so for example
: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
profileSimilar for :resource-paths
if you need isolation there as well