Java 和 Clojure 与 Leiningen [英] Java and Clojure with Leiningen

查看:20
本文介绍了Java 和 Clojure 与 Leiningen的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用 leiningen 在项目中与 Clojure 一起轻松管理和编译本机 Java 类?

Is it possible to easily manage and compile native Java classes alongside Clojure in a project using leiningen?

我在一个相当低的级别(使用 netty nio)工作,并认为在构建代码和性能方面,一些管道类实际上更容易作为原始 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.

推荐答案

莱宁根教程 有如下声明

对于包含一些 Java 代码的项目,您可以将 project.clj 中的 :java-source-path 键设置为包含 Java 文件的目录.然后 javac 编译器将在您的 Clojure 代码被 AOT 编译之前运行,或者您可以使用 javac 任务手动运行它.

For projects that include some Java code, you can set the :java-source-path key in project.clj to a directory containing Java files. Then the javac compiler will run before your Clojure code is AOT-compiled, or you can run it manually with the javac task.

所以如果设置了 :java-source-paths 选项,它应该是开箱即用的

so it should work out of box if :java-source-paths option is set

这篇关于Java 和 Clojure 与 Leiningen的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆