[英]Java and Clojure with Leiningen
Is it possible to easily manage and compile native Java classes alongside Clojure in a project using leiningen? 是否有可能在使用leiningen的项目中与Clojure一起轻松管理和编译本机Java类?
I am working at a pretty low level (with netty nio) and thinking that some of the plumbing classes would actually be easier to handle as raw java both in terms of constructing the code as well as performance. 我工作在一个相当低的水平(使用netty nio),并认为一些管道类实际上更容易处理作为原始java在构造代码和性能方面。
As of Leiningen 2.x, :java-source-path
has been replaced with :java-source-paths
, whose value is now specified as a vector rather than a string. 从Leiningen 2.x开始, :java-source-path
已被替换为:java-source-paths
,其值现在被指定为向量而不是字符串。
A good place to find a full (up-to-date) documentation of Leiningen features is to peruse the sample project file . 查找Leiningen功能的完整(最新)文档的好地方是仔细阅读示例项目文件 。 In this case, you will see: 在这种情况下,您将看到:
:java-source-paths ["src/main/java"]
In Leiningen tutorial there is following statement 在Leiningen教程中有以下声明
For projects that include some Java code, you can set the :java-source-path key in project.clj to a directory containing Java files. 对于包含一些Java代码的项目,可以将project.clj中的:java-source-path密钥设置为包含Java文件的目录。 Then the javac compiler will run before your Clojure code is AOT-compiled, or you can run it manually with the javac task. 然后javac编译器将在您的Clojure代码进行AOT编译之前运行,或者您可以使用javac任务手动运行它。
so it should work out of box if :java-source-paths
option is set 因此,如果设置了:java-source-paths
选项,它应该在盒子外工作
Use Vinyasa - I wrote it especially to deal with this problem 使用Vinyasa - 我写它是为了解决这个问题
Here is a blog post Dynamic reloading of java code in emacs/nrepl 这是一篇博客文章动态重新加载emacs / nrepl中的java代码
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.