I think there’s some old clutter in my top level project.clj that I don’t understand.
What does this mean?
`:main ^:skip-aot clojure-rte.rte.core
I think it is wrong. here is the entire file
(defproject clojure-rte "0.1.0-SNAPSHOT"
:description "Regular type expressions, for Clojure"
:url ":jnewton/clojure-rte.git"
:license {:name "MIT"
:url ""}
:plugins [[lein-cloverage "1.2.4"]
[lein-ns-dep-graph "0.2.0-SNAPSHOT"]
[cider/cider-nrepl "0.55.0"]
]
:jvm-opts ["-Xmx1g" "-XX:+HeapDumpOnOutOfMemoryError" "-Djdk.attach.allowAttachSelf"
;; increase stack size x6, for preventing SO errors:
;; (The current default can be found with
;; `java -XX:+PrintFlagsFinal -version 2>/dev/null | grep "intx ThreadStackSize"`)
"-Xss6144k"
;; Prevents trivial StackOverflow errors:
"-XX:MaxJavaStackTraceDepth=1000000"
;; the --add-opens= is for supressing the following warnings
;; WARNING: An illegal reflective access operation has occurred
;; WARNING: Illegal reflective access by clojure.lang.InjectedInvoker/0x0000000800232040 (file:/Users/jimka/.m2/repository/org/clojure/clojure/1.10.3/clojure-1.10.3.jar) to method com.sun.xml.internal.stream.writers.XMLStreamWriterImpl.writeCharacters(java.lang.String)
;; WARNING: Please consider reporting this to the maintainers of clojure.lang.InjectedInvoker/0x0000000800232040
;; WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
;; WARNING: All illegal access operations will be denied in a future release
"--add-opens=java.xml/com.sun.xml.internal.stream.writers=ALL-UNNAMED"
]
:dependencies [[org.clojure/clojure "1.12.0"]
[org.clojure/data.csv "1.1.0"]
[metasoarous/oz "2.0.0-alpha5"]
[lein-cloverage "1.1.2"]
[org.clojure/data.json "1.0.0"]
[com.clojure-goes-fast/clj-async-profiler "0.5.1"]
[backtick "0.3.4"]
[org.clojure/core.memoize "1.0.236"]
[org.clojure/math.combinatorics "0.1.6"]]
:main ^:skip-aot clojure-rte.rte.core
:target-path "target/%s"
:profiles {:test {:plugins [[lein-test-report-junit-xml "0.2.0"]]}
:uberjar {:aot :all}}) I suspect it is there from the time the directory structure was different.
If you don't get a timely answer here, you can ask in #leiningen (I no longer remember how/why ^:skip-aot is added/used, since I haven't really used lein since 2015).
i think the documentation about this stuff is just a reference project.clj file with comments
what about the part clojure-rte.rte.core ? I think there used to be a directory named clojure_rte long ago.
Yeah, if you change your -main namespace, Leiningen expects you to update project.clj to match.
is this a library or an application? it's kind of weird for a library to have a main
@technomancy I don’t know the answer to that. how can I know if code is a library or an application?
you are the author here. clojure.data.json is clearly a library. i’m imagining you run your project and it is clearly an application
are you asking the definition of "library" and "application"?
@technomancy yes, exactly. I feel like it is a library, which exposes an API. However, for demo purposes it sometimes acts like an application, or several different applications.
OK, I discovered a clue with regard to :main
I’ve changed it to
:main ^:skip-aot rte.core
then when I restart cider and try to load a test case file, clojure complains that it cannot find the first namespace in my require list.
But if I change it back to
:main ^:skip-aot clojure-rte.rte.core
and restart, then cider is again happy and finds my files.
I don’t really understand, but clojure-rte is simply the name of my top level directory, i.e. name of the git repository. within that there are a src and a test directory. under src there is more hierarchy which is modeled in the ns names in the :require section of all the ns declarations.However, this :main line does not seem to make a difference when I run the tests from the unix command line with lein test
:main identifies the ns to look in for a -main function, when you do lein run.
So :main clojure-rte.rte.core indicates that the -main function in src/clojure_rte/rte/core.clj should be run.
(and if you do lein uberjar, that's also the entry point for java -jar path/to/uber.jar -- but the :uberjar profile in your project.clj has :aot :all so I would expect it to compile all source nses to .class files as it builds the JAR file)
What is the best option to create documentation on GitHub Pages for a Clojure project? It seems like cljdoc requires its own server and cannot generate static HTML(?)
I like quickdoc, it's just markdown
Nice, thanks
You provide markdown to cljdoc and it generates the html for you. Which part doesn't work for you?
I don't know what is the best option, but the one I'm currently using (its documentation looked reasonable and I could get it to do what I want) is Codox: https://github.com/weavejester/codox
hey all, i have 2 questions regarding environment configuration setup 1. i'm currently using https://github.com/juxt/aero as a config reader and i was wondering how to pass the profile variable? 2. what should be the default for the profile var? should it opt to dev or prod? would love to hear your thoughts!
1. I use a separate env var read via (System/getenv) - but also used command line flags in the past
2. in my case development environment is the default, test and prod are separate profiles
I pass in a value as java parameter defined on my alias in deps.edn:
:dev {:jvm-opts ["-Dprofile=dev"] ... }
and then pass that in when I call aero:
(defn get-profile []
(or (keyword (System/getProperty "profile")) :dev))
(defn config
"Read `config.edn` from classpath using :profile from JVM sys prop."
[profile]
(aero/read-config (io/resource "config.edn") {:profile profile}))@michaeljweaver that's what i thought as well (pass in the alias). and i see that you default for dev
An alternative is to use different -mains in different files that you make available via different classpaths for prod and dev aliases. But it would become slightly messier.