Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>First, it does not seem like Leiningen supports a module hierarchy like Maven does. The checkouts are the next closest thing it has. It should be sufficient though to develop a modular application in Clojure though.</p> <p>For the project structure, I would have an API project, a "core" project, the plugins themselves, and a separate packaging project. The core and the plugins should only depend on the API. Which build tool you use to create the packaging project is up to you. Gradle would probably be more effective at handling the packaging, however having the "checkout" functionality Leiningen offers could make development of the system as a whole easier.</p> <p>I would take a look at the code for Leiningen and Noir to figure out how to effectively handle this.</p> <p>For dynamically loading the plugins, I would start with looking how Noir handles it in two of their files:</p> <ul> <li><a href="https://github.com/ibdknox/noir/blob/master/src/noir/server.clj" rel="noreferrer">server.clj</a> has namespace loading for all files under a particular namespace. Under the hood it uses <a href="https://github.com/clojure/tools.namespace/" rel="noreferrer">tools.namespace</a>, but you can easily see how it's used to <code>require</code> every namespace under a particular base. This is how Leiningen handles custom tasks as well - the base definition for the task should be in the leiningen.$task namespace.</li> <li><a href="https://github.com/ibdknox/noir/blob/master/src/noir/core.clj" rel="noreferrer">core.clj</a> has what I would use for plugin registration. In summary, use a map under an <code>atom</code> and add plugins to that map. I would advice wrapping the registration with a macro to keep your code cleaner.</li> </ul> <p>What I listed above should be sufficient if you don't need to handle adding plugins at run time. If you don't have every plugin on the classpath during start-up, I would recommend utilizing <a href="https://github.com/cemerick/pomegranate" rel="noreferrer">pomegranite</a> to add entries to the classpath. You can see an example in <a href="https://github.com/technomancy/leiningen/blob/master/leiningen-core/src/leiningen/core/classpath.clj" rel="noreferrer">classpath.clj</a>.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload