I'm modeling a collection of custom boot-clj tasks. The structure of the project is very similar to the one of bootlaces.
The tasks defined in there work well when they refer to built-in tasks, which are required as [boot.task.built-in :refer :all]. One task however should make use of a third-party task from boot-cljs. Requiring it via [adzerk.boot-cljs :refer [cljs]] works well in the project's compilation and installation phase.
When requiring the tasks in another project, the following error occurs:
Could not locate adzerk/boot_cljs__init.class or adzerk/boot_cljs.clj on classpath.
In other words: What would one have to do if one of the exported tasks in this file needs to use the cljs task.
Related
I have been using Clojure, ClojureScript, lein, shadow-cljs, re-frame, reagent, Emacs, and CIDER to work on a Clojure/ClojureScript dynamic web app project.
Currently, the project uses project.clj and shadow-cljs.edn to declare dependencies.
There is a discussion about changing things so that:
1 - We would start using a lein plug-in called lein-tools-deps
2 - Also, we would tweak shadow-cljs.edn file so that the dependencies would be removed and the file only indicate:
:dependencies true
3 - Finally, we would create a new deps.edn file holding all the dependencies.
It is not totally clear the advantages of this process.
I can see one: instead of declaring dependencies on shadow-cljs.edn and on project.clj they would be in a single file: deps.edn.
Is there another benefit of having dependency declaration via deps.edn instead of using shadow-cljs.edn and project.clj via :dependencies?
For instance, would this affect the use of Maven packages hosted on GitHub packages? Is deps.edn better for that?
deps.edn has the benefit that it supports direct git dependencies (ie. :git/url), as well as an easy mechanism for local dependencies (ie. :local/root). It is also more modern and becoming the "default".
shadow-cljs.edn has no support for these features, project.clj has some via plugins or other mechanism (eg. checkouts).
So, if you want those features it make sense to use deps.edn. However, depending on how complex your project is that might not be an easy switch.
shadow-cljs ultimately doesn't care how you manage your dependencies, but if you move things out of shadow-cljs.edn you are taking "power" away from it. If managed via shadow-cljs.edn it tries to prevent certain mistakes (eg. dependency conflicts), it can't do that when running via deps.edn. So, you'll have to sort those out manually potentially. It may just work, really depends on your project.
We build our application suite out of libraries and standalone uberjars, using Leiningen to build. We use the lein-parent plugin and have a parent project that sets versions for 3rd party dependencies and for our own libraries.
Our team is distributed and builds locally, using a central Artifactory for libraries. Consequently, we tend to set library versions to -SNAPSHOT qualifiers to ensure that everyone who thinks they're working at the head of the main branch is getting the latest library jars. The parent project itself has a -SNAPSHOT qualifier, since there is constant churn in 3rd party dependencies as we (for example) mitigate code vulnerabilities as found by tooling such as the OWASP vulnerability checker.
At release time, we need to freeze all this: the -SNAPSHOT qualifiers need to come off the parent project and each of the child projects. The lein release tooling does this just fine. Commands like lein release take care of project versions, and lein change :parent-project:coords set [groupid/artifactid "version"] can take care of references in child projects to the parent.
However, we can't find any Leiningen tooling that can automatically go into the :managed-dependencies vector of the parent project and update versions of specified child projects. It appears that lein change can only deal with values that are keyed in project maps.
Has anyone found a workable solution for managing interdependencies between parent and child projects during release tasks?
Leiningen 2.9.9-SNAPSHOT now supports editing the version of a specific dependency in a project's :dependencies or :managed-dependencies vector, in a parent or child project.
I have multiple, separate leiningen projects that ostensibly could depend on one-another.
Example:
~/projects/mywebapp (my own project)
~/projects/noir (a clone of the github repo)
~/projects/clojureql (a clone of the github repo)
I want to have them all compiled into the same JVM at the same time. I would like to run the git repos bleeding edge (pulling new commits/making my own commits) and not have to run lein jar or lein deps and certainly not have to restart the VM if I change any of the projects.
Here's a use case:
After running lein swank, from within emacs, I connect to the repl and compile a file from mywebapp (with C-c-k), which requires a file from noir. It finds the version of the file in my projects directory. Later, I open that file, edit it, and compile it (with C-c-k).
Note that I'm not asking for auto-compiling when I do git pull. I just don't want to have to restart the JVM or do lengthy jar compiling processes.
Is this possible in leiningen? How can I set this up?
Does this question from the Lein FAQ help?
Q: I want to hack two projects in parallel, but it's annoying to switch between them.
A: Use a feature called checkout dependencies. If you create a directory called checkouts in your project root and symlink some other
project roots into it, Leiningen will allow you to hack on them in
parallel. That means changes in the dependency will be visible in the
main project without having to go through the whole
install/switch-projects/deps/restart-repl cycle. Note that this is not
a replacement for listing the project in :dependencies; it simply
supplements that for tighter change cycles.
If you're already using swank, you don't need lein checkout dependencies. You can just C-c C-k your project (which will load the jarred versions of noir/whatever), and then browse to your local version of noir and C-c C-k that as well. Swank happily sends all the code to your repl, and the jvm never need know that it came from a different place!
I can only recommend this for smallish changes though, because I think if you compile noir.core, which depends on (say) noir.internal, clojure will load the jarred version of noir.internal even while you compile the local version of noir.core. Even so, it's a handy trick in general.
I use leiningen to manage my clojure project and I want to copy jar file along with some other files into a certain directory as a final part of a build process. Leiningen treats 'resources' as something which should be included into the jar file, and it is unacceptable for me. If I used maven, I could configure it for such task using maven-resource-plugin or fall back to Ant using maven-antrun-plugin, but leiningen is far more convenient tool for clojure projects.
Strangely, I couldn't manage to find anything about similar functionality in leiningen on the internet. This is curious, because one of major clojure applications is web sites, and web sites usually do not include their resources (js, css, etc) into the jar (or do they? That would be weird since slight css tweak will require rather lenghty recompilation). It comes naturally that we have to prepare site environment (copy static resources along with jar bundle into some directory layout), and this task should be done by the build tool.
Is there a plugin to copy files around the filesystem (or something which could substitute it, like running Ant), or I must write one myself? Right now I'm using shell scripts, but it is very inconvenient since I had to run several commands instead of one, and also it is unportable.
did you checkout lein-resource?
in any case. here is a long list of available plugins for lein, maybe you will fine some of them helpful
I have multiple, separate leiningen projects that ostensibly could depend on one-another.
Example:
~/projects/mywebapp (my own project)
~/projects/noir (a clone of the github repo)
~/projects/clojureql (a clone of the github repo)
I want to have them all compiled into the same JVM at the same time. I would like to run the git repos bleeding edge (pulling new commits/making my own commits) and not have to run lein jar or lein deps and certainly not have to restart the VM if I change any of the projects.
Here's a use case:
After running lein swank, from within emacs, I connect to the repl and compile a file from mywebapp (with C-c-k), which requires a file from noir. It finds the version of the file in my projects directory. Later, I open that file, edit it, and compile it (with C-c-k).
Note that I'm not asking for auto-compiling when I do git pull. I just don't want to have to restart the JVM or do lengthy jar compiling processes.
Is this possible in leiningen? How can I set this up?
Does this question from the Lein FAQ help?
Q: I want to hack two projects in parallel, but it's annoying to switch between them.
A: Use a feature called checkout dependencies. If you create a directory called checkouts in your project root and symlink some other
project roots into it, Leiningen will allow you to hack on them in
parallel. That means changes in the dependency will be visible in the
main project without having to go through the whole
install/switch-projects/deps/restart-repl cycle. Note that this is not
a replacement for listing the project in :dependencies; it simply
supplements that for tighter change cycles.
If you're already using swank, you don't need lein checkout dependencies. You can just C-c C-k your project (which will load the jarred versions of noir/whatever), and then browse to your local version of noir and C-c C-k that as well. Swank happily sends all the code to your repl, and the jvm never need know that it came from a different place!
I can only recommend this for smallish changes though, because I think if you compile noir.core, which depends on (say) noir.internal, clojure will load the jarred version of noir.internal even while you compile the local version of noir.core. Even so, it's a handy trick in general.