This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-02-16
Channels
- # aleph (2)
- # beginners (68)
- # boot (25)
- # bristol-clojurians (5)
- # cider (10)
- # cljs-dev (60)
- # cljsrn (1)
- # clojure (138)
- # clojure-austin (1)
- # clojure-france (2)
- # clojure-greece (11)
- # clojure-italy (4)
- # clojure-russia (16)
- # clojure-spec (4)
- # clojure-uk (75)
- # clojurescript (26)
- # core-async (28)
- # cursive (25)
- # data-science (4)
- # datomic (16)
- # defnpodcast (2)
- # devops (2)
- # docs (10)
- # duct (11)
- # emacs (1)
- # events (1)
- # figwheel (8)
- # fulcro (61)
- # garden (2)
- # hoplon (6)
- # java (6)
- # jobs-discuss (1)
- # lein-figwheel (14)
- # leiningen (86)
- # luminus (11)
- # off-topic (8)
- # parinfer (9)
- # pedestal (2)
- # re-frame (19)
- # reagent (1)
- # ring (3)
- # ring-swagger (8)
- # shadow-cljs (278)
- # spacemacs (13)
- # sql (5)
- # testing (7)
- # unrepl (8)
- # yada (25)
I am trying to create a project.clj for a maven based project which is based on spring boot
and spring boot dependencies are managed using "managed-dependencies" based on a spring boot parent
i tried to use lein-parent (https://github.com/achin/lein-parent), but it seems like it only work for leiningen parent projects
;; Spring boot parent project
:parent-project {:coords [org.springframework.boot/spring-boot-starter-parent "1.5.10.RELEASE" :extension "pom"]
:inherit [:managed-dependencies]}
;; managed dependencies
:managed-dependencies [[org.springframework.cloud/spring-cloud-dependencies "Edgware.SR2"]]
:dependencies [
;; Spring framework
;; these are managed dependencies and versions are managed by parent
[org.springframework.cloud/spring-cloud-starter-oauth2 ]
[org.springframework.boot/spring-boot-starter-security]
[org.springframework.boot/spring-boot-starter-web]
[org.springframework.boot/spring-boot-starter-websocket]
[org.springframework.boot/spring-boot-starter-test :scope "test"]
[org.springframework.security/spring-security-test :scope "test"]
;; h2 database
[com.h2database/h2 :scope "runtime"]
;; clojure dependency :slightly_smiling_face:
[org.clojure/clojure "1.9.0"]]
@gklijs I have existing spring boot application where i want to bring in clojure and clojurescript goodness in there.
Clojure was not a big problem, worked fine with maven, but for clojurescript, I found it easy to use cljsbuild with leiningen, and thus wanted to convert the maven pom to project.clj,
I will try to tinker a little bit with the lein-parent to see if i can do something with pom instead of a project.clj in the parent
@neupsh https://github.com/amperity/lein-monolith works from the other direction; not sure if it’ll be useful, but you could get the metaproject to output a pom for consuming in maven perhaps?
@greg316 I don't think it will help, as I need a way to merge the :managed-dependencies of current project from the parent project distributed as pom
Does :global-vars
not work within a profile? I like to use *warn-on-reflection*
and *unchecked-math*
only during development so figured it'd be best to put them in a :user
profile and launch it with lein with-profiles +user repl
, but it's not throwing the few warnings I left.
Oh, really? If it's active by default then why is it advised to not define it in project.clj?
because some profiles such as user
and system
are meant to be used at the user and system level, respectively
putting :user in project.clj imposes what should be individual preferences on everyone developing a project
similarly, if you put a :dev
profile in ~/.lein/profiles.clj
and had a :dev
profile in project.clj
, you’d only see the config from your project
So, it seems I have two issue here: 1. What profile do I actually want to use for something like this? 2. Regardless, why aren't my :global-vars
working?
you could install https://github.com/greglook/lein-cprint and run lein cprint :global-vars
to see what leiningen thinks the compose project definition looks like
> I actually don’t want it to load by default whenever I open a repl.
Maybe what you want is lein check
for the reflection warnings?
alternately, you could make a profile that you turn on deliberately:
{:global-warnings {:global-vars {,,,}}
:user {:aliases {"noisy-check" ["with-profile" "+global-warnings" "check"]}}}
(untested)I added the profile above and ran the command and it warned me about some issues (in dependencies, but still)
project/.lein is nothing
I mean, project/.lein/ can exist, but nothing looks for anything there
you can have user-level profiles in ~/.lein/profiles.clj
or ~/.lein/profiles.d/{profile}.clj
which is useful to put in .gitignore
and keep environment configs you don’t want to check in
so I usually have a profiles.clj
in each project with something like this in it:
{:local ^:repl
{:env {:my-var "foo"
,,,}
,,,}}
It seems to be working now that I put it in just ./profiles.clj
but I get that warning about :user
level profile in project files. The behavior for check also runs through everything I have in source whereas I'd prefer just the namespaces I require at the top level 😕
Yeah, got that. But since it's not default I can't use your cool :noisy-check
alias. That's nice, although not sure if it's what I want considering it checks files I have essentially as scratch
yeah, might make more sense to stick into your user-level profiles if you want the alias to be available by default
I don’t know of a way to restrict the files that check
operates against - it does a full test-compile of your source code
But I can still use :global-warnings
to launch a repl and get the behavior I want, right?
other than putting your scratch code into another directory and adding a :source-paths
entry to the :repl
profile (or something else not active by default)
you could make a replacement for check that starts with your :main or :init-ns instead of eagerly checking every file in the tree
check is simple enough that shouldn’t be hard
unless… it’s possible the global-vars might not apply to the repl process, since that gets launched separately from lein :thinking_face:
Wait so first things first... @greg316 what exactly do you mean by user-level profiles?
Oh I see. No, I'm just trying to define it at the project level and avoid that warning.
well, if you only want these available in the one project, you could put the :noisy-check
profile in your project.clj
and then put the alias directly in the project file
I don’t think there’s a way to have the alias available by default (without adding it to project.clj
), but if you don’t mind typing lein with-profile +noisy-check check
then you could just put the :noisy-check
profile in your project-local profiles.clj
@noisesmith would you mind advising re: overriding check?
all check does is call compile
on each file on disk
Could I just replace it in my alias with something like "compile core"
if core is my main ns?
calling compile on the one file with your main or init-ns should also transitively give you warnings about everything required
right, it’s the clojure compile function so it would be (compile some.ns)
(with warn-on-reflection and warn-on-boxed turned on, of course)
As should be painfully obvious, I've gotten by for a long time now not really understanding leiningen...